Commit b3b0c671 by Jason Merrill

c++: Find parameter pack in typedef in lambda [92909].

find_parameter_packs_r doesn't look through typedefs, which is normally
correct, but that means we need to handle their declarations specially.

gcc/cp/ChangeLog
2020-03-14  Jason Merrill  <jason@redhat.com>

	PR c++/92909
	* pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
	DECL_ORIGINAL_TYPE of a typedef.
parent c393c99d
2020-03-14 Jason Merrill <jason@redhat.com>
PR c++/92909
* pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
DECL_ORIGINAL_TYPE of a typedef.
2020-03-14 Jason Merrill <jason@redhat.com>
PR c++/93248
* pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
substituting DECL_ARGUMENTS.
......
......@@ -3916,10 +3916,18 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
return NULL_TREE;
case DECL_EXPR:
/* Ignore the declaration of a capture proxy for a parameter pack. */
if (is_capture_proxy (DECL_EXPR_DECL (t)))
*walk_subtrees = 0;
return NULL_TREE;
{
tree decl = DECL_EXPR_DECL (t);
/* Ignore the declaration of a capture proxy for a parameter pack. */
if (is_capture_proxy (decl))
*walk_subtrees = 0;
if (is_typedef_decl (decl))
/* Since we stop at typedefs above, we need to look through them at
the point of the DECL_EXPR. */
cp_walk_tree (&DECL_ORIGINAL_TYPE (decl),
&find_parameter_packs_r, ppd, ppd->visited);
return NULL_TREE;
}
case TEMPLATE_DECL:
if (!DECL_TEMPLATE_TEMPLATE_PARM_P (t))
......
// PR c++/92909
// { dg-do compile { target c++11 } }
template <class ... Ts>
void foo()
{
[]
{
using T = Ts;
}(); // { dg-error "not expanded" }
}
template void foo<>();
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