[Bug 10804] New: [3.4 regression] missing implicit instantiation of template static methods

gcc-bugzilla@gcc.gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 21 17:51:00 GMT 2003


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

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

           Summary: [3.4 regression] missing implicit instantiation of
                    template static methods
           Product: gcc
           Version: 3.4
            Status: NEW
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: harinath@cs.umn.edu
                CC: bangerth@dealii.org,gcc-bugs@gcc.gnu.org

Linking fails on the following file:

--8<--
template<class T>
struct A
{
  A() { const void (*a)() = foo; }
  static const void foo() {}
};

int main(int argc, char *argv[])
{
  A<int> a;
}
--8<--

with the error:
/tmp/ccube68X.o(.gnu.linkonce.t._ZN1AIiEC1Ev+0x9): In function `A<int>::A[in-charge]()':
: undefined reference to `A<int>::foo()'
collect2: ld returned 1 exit status

There is no problem with GCC 3.2.

Release:
gcc version 3.4 20030512 (experimental)

Environment:
i686-pc-linux-gnu

How-To-Repeat:
c++ implicit-instantiation.cc

Here's the output of nm with GCC 3.4:

         U A<int>::foo()
00000000 W A<int>::A[in-charge]()
00000000 T main

and here's the output with GCC 3.2

00000000 W A<int>::foo()
00000000 W A<int>::A[in-charge]()
         U __gxx_personality_v0
00000000 T main

Notice that GCC 3.4 did DTRT with the constructor.  If I replace the use of foo in the code with a direct method call, then there's no problem either.
------- Additional Comments From bangerth@dealii.org  2003-15-05 18:36 -------
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. A mainline regression




------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the Gcc-bugs mailing list