This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Possible bug in the template instanciation machinery
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: Possible bug in the template instanciation machinery
- From: Gabriel Dos Reis <Gabriel dot Dos-Reis at cmla dot ens-cachan dot fr>
- Date: 07 Apr 1999 12:25:21 +0200
- Organization: CMLA, ENS Cachan -- CNRS URA 1611 (France)
Consider the following:
poivre% cat b.C
template<class T> struct Y { typedef T X; };
// Primary base
template<class T, class U> struct Base {};
// partial specializations
template<class T> struct Base<T, typename T::X> {};
template<class T> struct Base<typename T::X, T> {};
template<class T, class U> struct Derived : Base <T, U> {};
struct A {};
template<class T> struct Derived<A, T> : Base< Y<T>, Y<T> > {};
int main()
{
Derived<A, int> d;
}
poivre% g++ -v; g++ b.C
Reading specs from /BASE/dosreis/EGCS/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.93.15/specs
gcc version egcs-2.93.15 19990405 (gcc2 ss-980929 experimental)
b.C: In instantiation of `Derived<A,int>':
b.C:19: instantiated from here
b.C:19: ambiguous class template instantiation for `struct Base<Y<int>,Y<int> >'
b.C:9: candidates are: struct Base<typename T::X,T>
b.C:7: struct Base<T,typename T::X>
b.C:19: base class `Base<Y<int>,Y<int> >' has incomplete type
>From my understanding of 14.5.4.1/1 EGCS gets it wrong because none of
the specialization matches Base< Y<int>, Y<int> >, so the instanciation
isn't ambiguous at all. It should be considering the primary template.
-- Gaby
--MAA00288.923480545/ariane.ens-cachan.fr--