16
In C++, a function template specialization is supposed to act exactly like a normal function. Does that mean that I can make one virtual?
For example:
struct A
{
template <class T> void f();
template <> virtual void f<int>() {}
};
struct B : A
{
template <class T> void f();
template <> virtual void f<int>() {}
};
int main(int argc, char* argv[])
{
B b;
A& a = b;
a.f<int>();
}
Visual Studio 2005 gives me the following error:
fatal error C1001: An internal error has occurred in the compiler.