diff options
author | Jason Merrill <jason@redhat.com> | 2018-06-12 23:33:06 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-06-12 23:33:06 -0400 |
commit | 79a9afa50f86669be04a3d3ef3068ddd43612f05 (patch) | |
tree | 30fa7ce5a79bfe42395187b86296cf784ef1e6a0 | |
parent | 8b4b756f2dc834577025b339eb1adc1f38763bce (diff) | |
download | gcc-79a9afa50f86669be04a3d3ef3068ddd43612f05.zip gcc-79a9afa50f86669be04a3d3ef3068ddd43612f05.tar.gz gcc-79a9afa50f86669be04a3d3ef3068ddd43612f05.tar.bz2 |
PR c++/86098 - ICE with template placeholder for TTP.
* typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check
CLASS_PLACEHOLDER_TEMPLATE.
From-SVN: r261536
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/class-deduction58.C | 16 |
3 files changed, 27 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 05105ae..4c23d57 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-06-12 Jason Merrill <jason@redhat.com> + + PR c++/86098 - ICE with template placeholder for TTP. + * typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check + CLASS_PLACEHOLDER_TEMPLATE. + 2018-06-12 Paolo Carlini <paolo.carlini@oracle.com> * decl2.c (coerce_new_type, coerce_delete_type): Add location_t diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 9febdb9..b033afd 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1375,6 +1375,11 @@ structural_comptypes (tree t1, tree t2, int strict) template parameters set, they can't be equal. */ if (!comp_template_parms_position (t1, t2)) return false; + /* If T1 and T2 don't represent the same class template deduction, + they aren't equal. */ + if (CLASS_PLACEHOLDER_TEMPLATE (t1) + != CLASS_PLACEHOLDER_TEMPLATE (t2)) + return false; /* Constrained 'auto's are distinct from parms that don't have the same constraints. */ if (!equivalent_placeholder_constraints (t1, t2)) diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction58.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction58.C new file mode 100644 index 0000000..82c3f83 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction58.C @@ -0,0 +1,16 @@ +// PR c++/86098 +// { dg-additional-options -std=c++17 } + +template <class _Res> class future; +template <class T> T&& declval(); + +template<template <class...> class T> +struct construct_deduced { + template <class... AN> + using deduced_t = decltype(T{declval<AN>()...}); + template<class... AN> + deduced_t<AN...> operator()(AN&&... an) const; +}; + +template<class T> +future<T> future_from(T singleSender); |