[Bug c++/56565] New: lambda function in NSMI fails to capture non-static data member.
ogoffart at kde dot org
gcc-bugzilla@gcc.gnu.org
Thu Mar 7 21:42:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56565
Bug #: 56565
Summary: lambda function in NSMI fails to capture non-static
data member.
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ogoffart@kde.org
This code is accepted by clang.
struct bug { int a; int *b = [&]{ return &a; }(); };
But GCC (4.7 and trunk) report a compilation error:
error: invalid use of non-static data member ‘bug::a’
struct bug { int a; int *b = [&]{ return &a; }(); };
^
error: from this location
struct bug { int a; int *b = [&]{ return &a; }(); };
^
calling this->a works.
More information about the Gcc-bugs
mailing list