Is it a semantic or syntax error to not have an argument list after a name prefixed by the template keyword?

113 views Asked by At

According to [temp.names]p6, "A name prefixed by the keyword template shall be followed by a template argument list or refer to a class template...".

The example provided shows

A<T> a;
a.template f<>(t);                    // OK, calls template
a.template f(t);                      // error: not a template-id

Would the error line be categorized as a semantic error or a syntax error? Since the standard states that a name must be followed up by an argument list, not that the name must be a valid template name, I'm inclined to calling this a syntax error. The example the standard provides explicitly comments that the error line doesn't reference a template id, but that's not what the paragraph refers to.

I am working on fixing this issue in Clang, but I'm curious where the problem should be tackled, on the parsing side or the semantic side.

0

There are 0 answers