The following code fails to compile: #include <memory> int main() { int x1; [e = std::make_shared <int> (), x1]() {}; } saying: /tmp/gcc-explorer-compiler116515-85-117auiu/example.cpp: In function 'int main()': 6 : error: 'x1' was not declared in this scope [e = std::make_shared <int> (), x1]() {}; ^~ 6 : error: redeclaration of '<typeprefixerror>x1' 5 : note: previous declaration 'int x1' int x1; ^~ Compilation failed (tested on gcc.godbolt.org, using gcc-6.1 -std=c++14)
Author: jason Date: Tue Feb 27 20:57:35 2018 New Revision: 258043 URL: https://gcc.gnu.org/viewcvs?rev=258043&root=gcc&view=rev Log: PR c++/71546 - lambda init-capture with qualified-id. * parser.c (cp_parser_lambda_introducer): Clear scope after each lambda capture. Added: trunk/gcc/testsuite/g++.dg/cpp1y/lambda-init17.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c
Fixed for GCC 8.