I have a code like:
class Client2ServerProtocol {
};
class ProtocolHelper {
public:
template
int GetProtocolId() {
return -1;
}
};
template<> inline int
ProtocolHelper::GetProtocolId() {
return 1;
}
template
class Dispatcher {
public:
template
void Subscribe(int msgId) {
int protoId = helper.GetProtocolId();
printf("Subscribe protoId %d, msgId %d", protoId, msgId);
}
PROTOCOL_HELPER helper;
};
int main() {
Dispatcher dispatcher;
dispatcher.Subscribe(1);
return 0;
}
It compiles successfully (and works) under MSVC, but gcc is complaining about invalid syntax:
test.cc:23:56: error: expected primary-expression before ‘>’ token
int protoId = helper.GetProtocolId();
test.cc:23:58: error: expected primary-expression before ‘)’ token
What i'm doing wrong?
int protoId = helper.GetProtocolId();
No comments:
Post a Comment