Consider :
template<typename U>
struct Test {
template<typename T>
typename enable_if, void>::type test() {
cout << "int" << endl;
}
template<typename T>
typename enable_if, void>::type test() {
cout << "char" << endl;
}
};
template<typename T>
typename enable_if, void>::type test() {
cout << "int" << endl;
}
template<typename T>
typename enable_if, void>::type test() {
cout << "char" << endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
test<int>();
test<char>();
Test<int>::test<double>(); // error
return 0;
}
MSVC9 will give a compilation error (see below) where marked. Am I
missing something obvious ?
Thanks,
J-L
1>c:\users\jll\documents\visual studio
2008\projects\boost_1_40_0\libs\rdb\test\test.cpp(325) : error C2143:
syntax error : missing ';' before '<'
1> c:\users\jll\documents\visual studio
2008\projects\boost_1_40_0\libs\rdb\test\test.cpp(333) : see reference
to class template instantiation 'Test<U>' being compiled
1>c:\users\jll\documents\visual studio
2008\projects\boost_1_40_0\libs\rdb\test\test.cpp(325) : error C4430:
missing type specifier - int assumed. Note: C++ does not support default-int
etc etc etc