http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52529
--- Comment #3 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-03-08 08:50:59 UTC --- The compiler is correct to reject your example FIRST, SECOND, and THIRD. In FIRST and THIRD you are effectively asking to deduce T from template <typename T> long foo(typename T::X *x); which is not possible in the general case, we have a so-called non-deduced context here. In SECOND you fixed the problem of FIRST correctly, but now you have the problem that A<M> is a dependent context. This means, that the compiler has to guess on the meaning of "<T" (It cannot safely assume that this is a function template). In this situation you are required to insert the "template" keyword to clarify the situation. Put it all together, the proper syntax would be A<M>().template foo<T>(x); Thus, this issue should be declared as invalid.