Commit 8afd9c45 by Jason Merrill Committed by Jason Merrill

PR c++/79640 - infinite recursion with generic lambda.

	* pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation
	before substituting its initializer.

From-SVN: r246289
parent 9f5af26d
2017-03-20 Jason Merrill <jason@redhat.com>
PR c++/79640 - infinite recursion with generic lambda.
* pt.c (tsubst_copy) [VAR_DECL]: Register the dummy instantiation
before substituting its initializer.
2017-03-20 Marek Polacek <polacek@redhat.com>
Paolo Carlini <paolo.carlini@oracle.com>
......
......@@ -14581,6 +14581,9 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
local static or constant. Building a new VAR_DECL
should be OK in all those cases. */
r = tsubst_decl (t, args, complain);
if (local_specializations)
/* Avoid infinite recursion (79640). */
register_local_specialization (r, t);
if (decl_maybe_constant_var_p (r))
{
/* We can't call cp_finish_decl, so handle the
......
// PR c++/79640
// { dg-do compile { target c++14 } }
template<typename F> void foo(F f)
{
f(1);
}
template<int> void bar()
{
const int i = i;
foo([] (auto) { sizeof(i); });
}
void baz() { bar<1>(); }
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