Files
gcc-reflection/gcc/testsuite/g++.dg/cpp1y/lambda-init19.C
Jakub Jelinek 152d47df7f re PR c++/89767 (ICE with tuple and optimization)
PR c++/89767
	* parser.c (cp_parser_lambda_introducer): Add ids and first_capture_id
	variables, check for duplicates in this function.
	* lambda.c (add_capture): Don't check for duplicates nor use
	IDENTIFIER_MARKED.
	(register_capture_members): Don't clear IDENTIFIER_MARKED here.

	* g++.dg/cpp1y/lambda-init18.C: New test.
	* g++.dg/cpp1y/lambda-init19.C: New test.
	* g++.dg/cpp1y/pr89767.C: New test.

From-SVN: r269860
2019-03-21 23:01:02 +01:00

16 lines
475 B
C

// PR c++/89767
// { dg-do compile { target c++14 } }
void bar (int);
void
foo ()
{
int x = 0;
int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0;
auto z = [x, y = [x] { bar (x); }, x] { y (); bar (x); }; // { dg-error "already captured 'x' in lambda expression" }
auto w = [x, a, b, c, d, y = [x] { bar (x); }, e, f, g, h, x] { y (); bar (x + a + b + c + d + e + f + g + h); }; // { dg-error "already captured 'x' in lambda expression" }
z ();
w ();
}