編譯器錯誤 C3190
具有所提供範本自變數的 'instantiation' 不是 'type' 任何成員函式的明確具現化
編譯程式偵測到嘗試進行明確的函式具現化;不過,提供的型別自變數不符合任何可能的函式。
下列範例會產生 C3190:
// C3190.cpp
// compile with: /LD
template<class T>
struct A {
A(int x = 0) {
}
A(int x, int y) {
}
};
template A<float>::A(); // C3190
// try the following line instead
// template A<int>::A(int);
struct Y {
template<class T> void f(T);
};
template<class T> void Y::f(T) { }
template void Y::f(int,int); // C3190
template<class OT> class X {
template<class T> void f2(T,OT);
};
template<class OT> template<class T> void X<OT>::f2(T,OT) {}
template void X<float>::f2<int>(int,char); // C3190
// try one of the following lines instead
// template void X<char>::f2(int, char);
// template void X<char>::f2<int>(int,char);
// template void X<char>::f2<>(int,char);