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: unassig...@gcc.gnu.org
        ReportedBy: ogoff...@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.

Reply via email to