Commit f6bef097 by Jason Merrill

c++: Fix decltype of empty pack expansion of parm.

In unevaluated context, we only substitute a single PARM_DECL, not the
entire chain, but the handling of an empty pack expansion was missing that
check.

	PR c++/93140
	* pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
	handling of TREE_CHAIN for empty pack.
parent ba672316
2020-02-05 Jason Merrill <jason@redhat.com>
PR c++/93140
* pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
handling of TREE_CHAIN for empty pack.
2020-02-05 Jakub Jelinek <jakub@redhat.com> 2020-02-05 Jakub Jelinek <jakub@redhat.com>
PR c++/93557 PR c++/93557
......
...@@ -14076,7 +14076,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) ...@@ -14076,7 +14076,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
/* Zero-length parameter packs are boring. Just substitute /* Zero-length parameter packs are boring. Just substitute
into the chain. */ into the chain. */
if (len == 0) if (len == 0 && !cp_unevaluated_operand)
RETURN (tsubst (TREE_CHAIN (t), args, complain, RETURN (tsubst (TREE_CHAIN (t), args, complain,
TREE_CHAIN (t))); TREE_CHAIN (t)));
} }
......
// PR c++/93140
// { dg-do compile { target c++11 } }
int
bar ()
{
return 42;
}
template <typename... R>
void foo (R... r, decltype (bar (r...)) x = 0) {}
int
main ()
{
foo (3);
}
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