This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
r=5931

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
problems.

Giovanni Bajo

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]