Reputation: 433
I'm trying to compile some old code (robocup soccer simulation server circa 2003) with a current c compiler:
gcc-c++-4.7.2-2.fc17.x86_64
The function below generates the error in the subject of this question. Any advice about how to modify the function to get rid of the error would be much appreciated.
int getInt( const std::string& param ) const
{ return rcss::conf::Builder::template get< int >( param ); }
Upvotes: 2
Views: 868
Reputation: 11
From C++03, 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.
In your example, rcss::conf::Builder
does not depend explicitly on a template-parameter, which makes the template
keyword useless (VC allows it).
Upvotes: 1
Reputation: 350
I am assuming that Builder
is a class and get
is a static template method of that class.
The keyword template
is telling the compiler that get
is a template method. However, gcc
is saying that you shouldn't use that keyword if it's not already within a template.
So, removing the template
keyword should make it work.
Upvotes: 1