This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/55015] Lambda functions not found at link time when declared in an inline function


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

Robert Xiao <spam_hole at shaw dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |spam_hole at shaw dot ca

--- Comment #2 from Robert Xiao <spam_hole at shaw dot ca> 2012-10-22 05:02:01 UTC ---
Minimal reproducible testcase:

    typedef void (*VoidFunc)();
    inline VoidFunc GetFunc() { return [](){}; }
    int main() { VoidFunc func = GetFunc(); }

Compiled with gcc version 4.7.2 (MacPorts gcc47 4.7.2_2). Output:

$ g++-mp-4.7 test.cpp -std=c++11
Undefined symbols for architecture x86_64:
  "GetFunc()::{lambda()#1}::_FUN()", referenced from:
      GetFunc()::{lambda()#1}::operator void (*)()() const in cciEeUag.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]