How can I get the below code to compile on g++ 4.7? It will compile if I place the body of foo
inline, but I don't want it inline (because the real code is a lot more complicated).
struct A
{
void foo();
} __attribute__((__may_alias__));
void A::foo() {}
int main() {return 0;}
Error:
/tmp/test.cpp:6:6: error: prototype for ‘void A::foo()’ does not match any in class ‘A’
/tmp/test.cpp:3:8: error: candidate is: void A::foo()