Hello.

The following does not compile:

---------

class A
{
public:
 class B {};
 template <class T, class X> void x(X a) {}
 template <class T> void x(int a);
};

template <class T>
void A::x (int a)
{ }

template void A::x<A::B> (int a);

----------

Namely, the explicit instantiation on the last line is rejected with the error:
test.cc:13: error: ambiguous template specialization ‘x<A::B>’ for ‘void
A::x(int)’

i.e. not even recognized as an explicit instantiation.
Implicit instantiation seems to work fine.

cheers

gcc config:
Configured with: ../configure --prefix=/usr --with-local-prefix=/usr/local
--infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64
--libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.3
--enable-ssp --disable-libssp --with-bugurl=http://bugs.opensuse.org/
--with-pkgversion='SUSE Linux' --disable-libgcj --with-slibdir=/lib64
--with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new
--disable-libstdcxx-pch --program-suffix=-4.3
--enable-version-specific-runtime-libs --enable-linux-futex
--without-system-libunwind --with-cpu=generic --build=x86_64-suse-linux
Thread model: posix
gcc version 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036] (SUSE
Linux)


-- 
           Summary: Explicit instantiation rejected
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: highegg at gmail dot com
GCC target triplet: Target: x86_64-suse-linux


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

Reply via email to