When a template publicly inherits from another template, aren't the base public methods supposed to be accessible?
template <int a>
class Test {
public:
Test() {}
int MyMethod1() { return a; }
};
template <int b>
class Another : public Test<b>
{
public:
Another() {}
void MyMethod2() {
MyMethod1();
}
};
int main()
{
Another<5> a;
a.MyMethod1();
a.MyMethod2();
}
Well, GCC craps out on this... I must be missing something totally obvious (brain melt). Help?
class Another
. If you fix that, then it is compiling fine in VS2008 – TundraTest<a>::MyMethod1
, 2) Use the prefixthis->MyMethod1
, 3) Add a statementusing Test<a>::MyMethod1
, 4) Use a global compiler switch that enables the permissive mode. The pros & cons and details of these solutions are described in #50322288 – Deciare