Using VS 2005 the following compiles but uncomment one, other, or both
pieces of code and I get the listed compiler errors. VS 2005 bug or
limitation or something I am missing?
Philip
enum MyEnum { myEnum };
class Test
{
public:
Test();
template<MyEnum, typename t>
Test(t);
template<MyEnum, typename t>
void memFunc(t);
};
// fails with
// error C2143: syntax error : missing ';' before '<'
// error C2350: 'Test::{ctor}' is not a static member
// template<>
// Test::Test<myEnum, int>(int)
// {
// }
template<MyEnum, typename t>
Test::Test(t)
{
}
// works
template<>
void Test::memFunc<myEnum, int>(int)
{
}
template<MyEnum, typename t>
void Test::memFunc(t)
{
}
void test1()
{
// fails with
// error C2143: syntax error : missing ';' before '<'
// Test test1<myEnum>(1);
// works
Test test2;
test2.memFunc<myEnum>(1);
}
--
[ See
http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]