Home

The code below does not compile under g++.

There is an outer class template that contains and inner class
template. The outer class template is fully specialized for int. Then
a separate Foo class template inherits from the inner.

The compiler indicates that the inner class is incomplete when used as
the base class of the inner class template. Why?

------------------------------------------------------------ -------
template <typename X> struct Outer {

template <typename Y> struct Inner {};

};

template <> struct Outer<int> { // If this full specialization is
removed, the compilation succeeds.

template <typename Y> struct Inner {};

};

template <typename T>
struct Foo: Outer<T>::Inner<T> {};

int main()
{
Foo<int> o;
return 0;
}
------------------------------------------------------------ -------

Interestingly, if I remove the full specialization, the compilation
succeeds, to add to my confusion.

Thanks

previous
next

Re: C++ Pitfall: const objects do not behave constantly.
Re: strange syntax in stl (gnu version)
Free trips around the globe!!!!!!!!!!
Re: sorteddict PEP proposal [started off as orderedict]
RFC-3986 or 2396 implementation in Python?
Fundacja Hobbit
Krwinka
Akogo
Fundacja Sloneczko
Fundacja Iskierka