This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/55720] New: [C++11] Linkage errors of static data member initializers with lambdas
- From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 17 Dec 2012 14:00:57 +0000
- Subject: [Bug c++/55720] New: [C++11] Linkage errors of static data member initializers with lambdas
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55720
Bug #: 55720
Summary: [C++11] Linkage errors of static data member
initializers with lambdas
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: daniel.kruegler@googlemail.com
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.