Hello,

compiling the following:
---8<---8<---8<---8<---
template<typename T>
struct Base
{
        typename T::Type        var;
};
template<typename U>
struct Derived : Base<Derived<U> >
{
        typedef U       Type;
};
void foo()
{
        Derived<int> i;
}
---8<---8<---8<---8<---
gives the error

gcctempl.cpp: In instantiation of ‘struct Base<Derived<int> >’:
gcctempl.cpp:7:8:   required from ‘struct Derived<int>’
gcctempl.cpp:13:15:   required from here
gcctempl.cpp:4:19: error: no type named ‘Type’ in ‘struct Derived<int>’

on all tested gcc versions (4.4, 4.5, 4.6,4.7). There is definitely a type called 'Type' in struct 'Derived'. I'm not sure, the above code might be ill-formed, but then I'd like to see a specific error message.

Regards, Peter


Reply via email to