The following program compiled with gcc 4.7.2 using the flags -Wall -std=c++0x -pedantic //------------------------ template <class T> struct X { static void (*code) (); }; template <class T> void (*X<T>::code) () = []{}; // Line 7 int main () { X<int>::code(); } //------------------------ gives a linkage error: "|In function `X<int>::code::{lambda()#1}::operator void (*)()() const':| 7|undefined reference to `X<int>::code::{lambda()#1}::_FUN()'| " The code should be accepted.
This is a split-off of bug 55710. The error also occurs on gcc 4.8.0 20121209 (experimental).
*** Bug 55834 has been marked as a duplicate of this bug. ***
There's no need to split this out. *** This bug has been marked as a duplicate of bug 55710 ***