2014-01-29 53 views
0

移植从GCC 2.95.3代码海湾合作委员会新的编译时错误4.4.2结果:太少模板参数列表 - 模板方法的专业化,G ++

too few template-parameter-lists 

下面是一个抽象和该代码的简化示例。该错误发生在标记线上。

#include <iostream> 
using namespace std; 

template<class SomeType> class SomeTemplate 
{ 
    public: 
    SomeType msg; 
    void Func(); 
}; 

void SomeTemplate<long>::Func()  //--- Error Here --- 
{ 
    cout << "SomeType size: " << sizeof (msg) << endl; 
} 

int main() 
{ 
    SomeTemplate<long> MyType; 
    MyType.Func(); 
} 
+0

是否有一个问题在这里? – Brian

+3

'template <>'似乎缺少。 – WhozCraig

+0

Clang给出了一个更好的信息:''模板专业化需要'模板<>'“' – 0x499602D2

回答

1

template <> 
void SomeTemplate<long>::Func()   
{ 
    cout << "SomeType size: " << sizeof (msg) << endl; 
}