[Bug c++/10530] [3.4 regression] Cannot access non-dependent type within nested template
reichelt at igpm dot rwth-aachen dot de
gcc-bugzilla@gcc.gnu.org
Fri Aug 1 20:56:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10530
------- Additional Comments From reichelt at igpm dot rwth-aachen dot de 2003-08-01 20:56 -------
Subject: Re: [3.4 regression] Cannot access non-dependent type
within nested template
On 21 Jul, GccBugs at Skyler dot com wrote:
> Is this related:
>
> struct Base2 { };
>
> template<class T>
> struct Base1
> {
> template<class U>
> struct TypeDef { typedef Base2 SecondBase; };
> };
>
> template<class T>
> struct Derived : public Base1<int>,
> public
> Base1<T>::TypeDef<float>::SecondBase
> { };
>
> int main (void)
> { Derived<long> derived; }
>
> g++ 3.2 under Cygwin in Win2K produces:
>
> t.cpp: In instantiation of `Derived<long int>':
> t.cpp:16: instantiated from here
> t.cpp:16: base class `Base1<T>::TypeDef<float>::SecondBase' has incomplete type
>
> Make either template a non-template class and the error message goes away.
No, your code is really broken. You have to write
Base1<T>::template TypeDef<float>::SecondBase
instead of
Base1<T>::TypeDef<float>::SecondBase
Regards,
Volker
More information about the Gcc-bugs
mailing list