http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47144
--- Comment #2 from Johannes Schaub <schaub.johannes at googlemail dot com> 2011-01-01 18:11:27 UTC --- (In reply to comment #1) > 4.4 rejects it: > > inv.cc:1: error: expected class-name before ‘int’ > inv.cc:1: error: expected ‘(’ before ‘int’ > > 4.5 accepts it without error > > current 4.6 rejects it with the following > > inv.cc:1:48: error: expected ‘;’ after struct definition > inv.cc:1:48: error: expected template-argument before ‘;’ token > inv.cc:1:48: error: expected ‘>’ before ‘;’ token > inv.cc:1:48: error: expected ‘::’ before ‘;’ token > inv.cc:1:48: error: expected unqualified-id before ‘;’ token > inv.cc:1:48: error: declaration does not declare anything [-fpermissive] > inv.cc:1:50: error: expected unqualified-id before ‘>’ token > > what 4.6.0 version are you using? Hmm, "4.6.0 20101113 (experimental)". I found the following does not error out on 4.1.2: template<typename T> struct A { }; template<typename T> struct C { typename A< struct B { } >::A x; }; C<int> c; Maybe it also works on 4.4. Note that this relies on "typename X::Y" to ignore non-type names, which I think is not according to the spec. See http://stackoverflow.com/questions/4420828/another-bug-in-g-clang-c-templates-are-fun and http://llvm.org/bugs/show_bug.cgi?id=8263 .