template<typename T> class A{}; template<typename T> class B{}; template<typename T> class C{}; template<typename T> class D{}; template<typename T> class E{}; template<typename T> void f() { typedef A<typename B<D<E<int> > > > foo; } gets you: ~/ootbc/members/src$ g++ foo.cc foo.cc: In function `void f()': foo.cc:7: error: template argument 1 is invalid foo.cc:7: error: ISO C++ forbids declaration of `foo' with no type In template metaprogramming spaghetti, it would sure help if the diagnostic said just *which* template invocation had argument trouble. Ivan
If we used the caret way of doing things it would just work.
(In reply to comment #1) > If we used the caret way of doing things it would just work. It won't work anyway if we don't have the columns right: GCC 4.7: pr24607.cc:7:37: error: template argument 1 is invalid pr24607.cc:7:42: error: invalid type in declaration before ‘;’ token
Still broken with GCC 4.8: pr24607.cc:7:37: error: template argument 1 is invalid typedef A<typename B<D<E<int> > > > foo; ^ pr24607.cc:7:42: error: invalid type in declaration before ‘;’ token typedef A<typename B<D<E<int> > > > foo; ^ Clang gets it right: /tmp/webcompile/_22150_0.cc:7:20: error: expected a qualified name after 'typename' typedef A<typename B<D<E<int> > > > foo; ^