Template syntax error

Started by
11 comments, last by jdhardy 20 years, 3 months ago
quote:The .template is required to disambiguate the grammar - less-than vs. template argument list.


Yes, but in ze_jackal''s case it is not required because neither r nor query are dependent names in the function. This is a gcc bug.
Advertisement
quote:Original post by Anonymous Poster
Yes, but in ze_jackal's case it is not required because neither r nor query are dependent names in the function. This is a gcc bug.


query does depend on the template parameter in his code. Which, IMHO, is exactly the case that 14.2.4 describes as needing an extra template keyword.

quote:
14.2.4
When the name of a member template specialization appears after . or -­> in a postfix-expression , or after nested-name-specifier in a qualified-id,
and the postfix-expression or qualified-id explicitly depends on a template-parameter(14.6.2), the member template name must be prefixed by the keyword template .


The name of the member template specialization in ze_jackal's code is 'query', which appears in a postfix-expression after a '.'. query depends on the template-parameter, and so the postfix-expression depends on the template-parameter, meaning the extra template keyword is needed.


[edited by - Jingo on January 19, 2004 5:39:50 AM]
Ugh. One of many things they didn''t teach me in university.

Man, do I ever hate templates. Just never can seem to get the damn things to work. >_<

/me goes back to his Java.

This topic is closed to new replies.

Advertisement