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++/11788] New: [3.4 regression] missing implicit instantiation of static member function


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: [3.4 regression] missing implicit instantiation of
                    static member function
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: critical
          Priority: P1
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org

Consider the following program:

------------------------------------------
template <typename> struct A
{
    static void foo() {}
};

int main()
{
    A<int> a;
    return (int)(&a.foo);
}
------------------------------------------

Compiling this with mainline (since the parser merge) results
in a linker error:

/tmp/ccWTn0Bs.o: In function `main':
/tmp/ccWTn0Bs.o(.text+0x11): undefined reference to `A<int>::foo()'

If I instantiate A<int>::foo explicitly the code compiles.
But IMHO the explicit instantiation isn't mandated.


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