ambiguous class template instantiation

Adrian Sandor aditsu@yahoo.com
Fri Oct 10 17:21:00 GMT 2003


I think I've just reproduced this problem with gcc 3.4
(experimental mingw 20030928, from thisiscool.com)
so it looks like it hasn't been fixed; should I write
a bug report? I don't really know how to use that
bugzilla...

Adrian

--- Adrian Sandor <aditsu@yahoo.com> wrote:
> Hello
> 
> I found a problem when trying to compile a piece of
> code. I simplified it to this:
> 
> template<class T1, class T2=int>struct s1{};
> template<class T>struct s2{};
> template<template<class>class C, class T>struct
> s2<C<T> >{};
> template<template<class, class>class C, class T1,
> class T2>struct s2<C<T1, T2> >{};
> s2<s1<int> >x1;
> 
> here's the compiler output:
> 
> g++.exe -c test.cpp -o test.o
> -I"C:/progs/Dev-Cpp/include/c++"
> -I"C:/progs/Dev-Cpp/include/c++/mingw32" -pedantic
> -Wall -W -Wno-long-long -fmessage-length=0
> test.cpp:5: ambiguous class template instantiation
> for
> `struct s2<s1<int, int> >'
> test.cpp:4: candidates are: struct s2<C<T1, T2> >
> test.cpp:3: struct s2<C<T> >
> test.cpp:5: aggregate `s2<s1<int, int> > x1' has
> incomplete type and cannot be defined
> test.cpp:5: storage size of `x1' isn't known
> 
> the compiler used is gcc 3.2 (mingw)
> I also confirmed this problem on a gcc 3.2.2 (linux)
> 
> I tested the same code at
> http://www.dinkumware.com/exam/ using different
> compilers and there was no error
> 
> I'd like to know if this is fixed in later versions
> of
> gcc (which versions?)
> I also found some similar reports in the mailing
> lists, but they're slightly different, so I don't
> know
> if it's the same problem
> 
> best regards,
> Adrian



__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com



More information about the Gcc-bugs mailing list