https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71546

            Bug ID: 71546
           Summary: lambda capture fails with "was not declared in this
                    scope"
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stefaan.deroeck at gmail dot com
  Target Milestone: ---

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)

Reply via email to