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



             Bug #: 55178

           Summary: lambda cannot be found at linkage stage

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

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

        ReportedBy: icegood1...@gmail.com





#include <iostream>



class intermed

{

public:

  virtual void Proceed(int cb(int))

  {

    cb(123);

  };

};



class smain

{

public:

  smain(intermed *Af_intermed)

  {

    f_intermed=Af_intermed;

  }



  virtual void run()

  {

    f_intermed->Proceed([](int num){ std::cerr<<num<<std::endl; return 0;});

  }



  intermed *f_intermed;

};



int main()

{

  //internal f_internal;

  intermed f_intermediate; //&f_internal

  smain f_main(&f_intermediate);

  //

  f_main.run();

}



with g++ -std=gnu++11 lambda_test.cpp

produces output:



/tmp/ccTez6Bj.o: In function `smain::run()::{lambda(int)#1}::operator int

(*)(int)() const':

lambda_test.cpp:(.text._ZZN5smain3runEvENKUliE_cvPFiiEEv[_ZZN5smain3runEvENKUliE_cvPFiiEEv]+0x9):

undefined reference to `smain::run()::{lambda(int)#1}::_FUN(int)'

collect2: error: ld returned 1 exit status



I intend to do functions as virtual to show that it not same as

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

Reply via email to