[Bug c++/19569] New: no code for explicit instantiation of template class specialization

jamesp at trdlnk dot com gcc-bugzilla@gcc.gnu.org
Fri Jan 21 18:12:00 GMT 2005


It appears that explicit instantiation of specialized template classes isn't
instantiating all of the class's members as it should:

--- Begin Sample Code ------------
template <typename T>
class A
{
public:
    void foo( T const & ) {}
};

template <>
class A<char>
{
public:
    void foo( char const & ) {}
};

template class A<int>;
template class A<char>;

--- End Sample Code ------------

When I compile the above code and run nm on the object file, I get:
%nm test.o
00000000 W _ZN1AIiE3fooERKi
%

The explicit instantiation of the char specialization of class A should have
created A<char>::foo(char const &).

-- 
           Summary: no code for explicit instantiation of template class
                    specialization
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jamesp at trdlnk dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


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



More information about the Gcc-bugs mailing list