http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55828



             Bug #: 55828

           Summary: problem with access to static method from lambda in

                    another method

    Classification: Unclassified

           Product: gcc

           Version: 4.7.3

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: vladimir.ba...@gmail.com





It looks like an issue.

When I'm trying to access to static method from lambda defined in another

method I'm getting following error:



Compilation finished with errors:

source.cpp: In lambda function:

source.cpp:7:22: error: 'this' was not captured for this lambda function





Sample code:

struct Test

{

   static void func1() {}

   void func2() 

   {

      auto f = []() {

         Test::func1();

      };

   }

};

int main()

{}



It's could be easily reproduced on gcc 4.7.3 and bellow.

I haven't checked iso standard for right behavior - but it seems msvc and clang

compilers work fine with this example.

Also it gets ok when I pass this to lambda.

Reply via email to