Commit 655b16da by Jason Merrill Committed by Jason Merrill

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
parent 6f9a76b1
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
......
......@@ -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;
}
......
// 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment