GCC/C++ won't let you overload a method name if one method is virtual and the other not.
Update: Some code:
#define g f
class A {
public:
virtual void g(int) = 0;
void f() { g(1); }
};
class B : public A {
void g(int) {}
};
int main() {
B b;
b.f();
return 0;
}
This code fails in the compiler:
In function `int main()':
14: error: no matching function for call to `B::f()'
8: note: candidates are: virtual void B::f(int)
If I remove the #define, then it passes the compiler (but fails the linker with vtable issues).
Update 2: As
ashley_y points out, the virtual is a red herring, and my issue is with a curious restriction on overloading in C++, so I can't really blame GCC.