I'm having a bit of a problem with inheriting template member functions. Here's what I've been able to boil it down to:
class Q {
public:
virtual int func () { return 4; }
template <typename T> int func () { return func(); }
};
class R : public Q {
public:
virtual int func () { return 5; }
};
int main (int argc, char* argv[]) {
Q q;
R r;
q.func<long>();
r.func<long>(); // error here
return 0;
}
In class Q the compiler can differentiate between func() and func<>() (the regular function and template one). But when inherited, the template memeber function seems to get lost somewhere. Now the funny thing is that if I replace class R with:
class R : public Q {};
it compiles fine. As well if I rename either of the functions it works as well.
Currently I'm using VS express. So what I'm wondering, am I doing something wrong here? Or is this a compiler issue?
*edited for typo