2014-01-29 50 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; 
}