c++/5931: ICE when using template class that is child if another template class

Giovanni Bajo giovannibajo@libero.it
Mon Jul 8 17:06:00 GMT 2002


Notice that the code is not legal C++. The snippet reported by Reichelt is:

------------------------snip here------------------------
template <typename T, typename U> struct A
     template <typename V> class SubA {};

 template <typename T> struct B : public A<T,int>::SubA<int> {};

 B<int> b;
 ------------------------snip here------------------------

which is not legal C++, because it's accessing a nested template without the
explicit template keyword. The correct version:

------------------------snip here------------------------
 template <typename T> struct B : public A<T,int>::template SubA<int> {};
------------------------snip here------------------------

which correctly compiles on my GCC 3.1. So the PR type should be changed to
ice-on-illegal-code. This should also solve the reporter's compilation

Giovanni Bajo

P.S: I'm not subscibed to any GCC list, so please include my adress in CC
list if needed.

More information about the Gcc-bugs mailing list