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++/55720] New: [C++11] Linkage errors of static data member initializers with lambdas


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.


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