template<typename T> struct Base : T { typedef T Derived; }; struct A { template<typename T> friend struct Base<T>::Derived::Crash; // nested.cpp:10: internal compiler error: in lookup_member, at cp/search.c:1213 // ICE with g++-4.0.3 // PASS with g++-3.4.6 };
4.2.0 rejects the code: t.cc:10: error: 'Crash' is not a member of 'T' This code is invalid. 3.3 gave: t.cc:10: error: typename type `typename Base<T>::Derived::Crash' declared `friend' ICC gives: t.cc(10): error: a qualified friend template declaration must refer to a specific previously declared template friend struct Base<T>::Derived::Crash; ^ compilation aborted for t.cc (code 2)
(In reply to comment #1) > 4.2.0 rejects the code: > t.cc:10: error: 'Crash' is not a member of 'T' > nested.cpp:10: internal compiler error: in lookup_member, at cp/search.c:1212 on g++-4.2 version 4.2.0 20060709 (experimental) (Debian 4.2-20060709-1) which g++-4.2 revision are you using to get ?: t.cc:10: error: 'Crash' is not a member of 'T'
(In reply to comment #2) > which g++-4.2 revision are you using to get ?: 4.2.0 20060821 aka two days ago's. I bet it was also fixed by 28304. You are using a month's old 4.2 compiler which is why you don't see the fix. If you are going to try the mainline, please try with at a max a week old compiler.
I can confirm that this is apparently fixed now. W.