This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/55015] Lambda functions not found at link time when declared in an inline function
- From: "spam_hole at shaw dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 22 Oct 2012 05:02:01 +0000
- Subject: [Bug c++/55015] Lambda functions not found at link time when declared in an inline function
- Auto-submitted: auto-generated
- References: <bug-55015-4@http.gcc.gnu.org/bugzilla/>
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