https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89978
Bug ID: 89978 Summary: Extraneous template keyword not rejected Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vincent.lextrait at gmail dot com Target Milestone: --- The compiler does not reject the following: struct A{ void f(){} }; struct B{ static A& n(){ return *new A(); } }; template <typename T> struct C{ void g(){ T::n().template f(); } }; int main(){ (new C<B>())->g(); } Function A::f is not template.