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)
Confirmed. Fails at least since GCC 3.3.
Mine.
Slightly more reduced rejects-valid testcase: template<class T, class U> void f(U); // #1 template<class T> void f(int) { } // #2 template void f<char>(int); more_specialized_inst is unable to determine that #2 is more specialized than #1. Perhaps we should be passing the explicitly specified template arguments to get_bindings? But that ends up breaking gcc/testsuite/g++.old-deja/g++.pt/explicit22.C among others..
PR102184 is probably due to the same underlying bug
*** Bug 104193 has been marked as a duplicate of this bug. ***
*** Bug 64063 has been marked as a duplicate of this bug. ***
*** Bug 104204 has been marked as a duplicate of this bug. ***