diff options
author | Jason Merrill <jason@redhat.com> | 2018-05-08 22:08:52 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-05-08 22:08:52 -0400 |
commit | 655b16da125b1210096b2f394ba0f222631fb44b (patch) | |
tree | 2ef60e2d4df2148fc0df8ab3e39ea8ace4d624cf /gcc | |
parent | 6f9a76b1a1937ca399a79515005dc0dad97f694c (diff) | |
download | gcc-655b16da125b1210096b2f394ba0f222631fb44b.zip gcc-655b16da125b1210096b2f394ba0f222631fb44b.tar.gz gcc-655b16da125b1210096b2f394ba0f222631fb44b.tar.bz2 |
PR c++/85706 - class deduction under decltype
* pt.c (for_each_template_parm_r): Handle DECLTYPE_TYPE. Clear
*walk_subtrees whether or not we walked into the operand.
(type_uses_auto): Only look at deduced contexts.
From-SVN: r260066
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/pt.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/concepts/class-deduction2.C | 9 |
3 files changed, 19 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index aa42de2..bf56581 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2018-05-08 Jason Merrill <jason@redhat.com> + + PR c++/85706 - class deduction under decltype + * pt.c (for_each_template_parm_r): Handle DECLTYPE_TYPE. Clear + *walk_subtrees whether or not we walked into the operand. + (type_uses_auto): Only look at deduced contexts. + 2018-05-08 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84588 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c604f46..180dfd6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9829,6 +9829,7 @@ for_each_template_parm_r (tree *tp, int *walk_subtrees, void *d) break; case TYPEOF_TYPE: + case DECLTYPE_TYPE: case UNDERLYING_TYPE: if (pfd->include_nondeduced_p && for_each_template_parm (TYPE_VALUES_RAW (t), fn, data, @@ -9836,6 +9837,7 @@ for_each_template_parm_r (tree *tp, int *walk_subtrees, void *d) pfd->include_nondeduced_p, pfd->any_fn)) return error_mark_node; + *walk_subtrees = false; break; case FUNCTION_DECL: @@ -26862,7 +26864,7 @@ type_uses_auto (tree type) them. */ if (uses_template_parms (type)) return for_each_template_parm (type, is_auto_r, /*data*/NULL, - /*visited*/NULL, /*nondeduced*/true); + /*visited*/NULL, /*nondeduced*/false); else return NULL_TREE; } diff --git a/gcc/testsuite/g++.dg/concepts/class-deduction2.C b/gcc/testsuite/g++.dg/concepts/class-deduction2.C new file mode 100644 index 0000000..286e59a --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/class-deduction2.C @@ -0,0 +1,9 @@ +// PR c++/85706 +// { dg-additional-options "-std=c++17 -fconcepts" } + +template<class T> struct S { + S(T); +}; + +template<class = void> +auto f() -> decltype(S(42)); // error |