Reputation: 1939
The following extract was previously compiling under Borland C++, MSVC and OpenWatcom:
class aaa {
virtual _fastcall ~aaa();
};
class bbb:public aaa {
};
It doesn't compile under gcc/g++ (MinGW 4.8.0). Error:
probz.cpp:7:7: error: conflicting type attributes specified for 'virtual bbb::~bbb()' class bbb:public aaa { ^ probz.cpp:3:20: error: overriding 'virtual aaa::~aaa()' virtual _fastcall ~aaa()=0;///can't be abstract ^
Obviously, there is no bbb::~bbb()!
The actual class hierarchy is bigger, there are many classes bbb inheriting from aaa, and there are intermediate members in between, i.e. bbb extends abb, which extends aab, which extends aaa. aaa indeed has an abstract virtual destructor, which gets implementation in the intermediate classes, but not in the leaves. Yes, I can remove the __fastcall
attribute and it compiles. Is it a gcc limitation that I cannot adjust the calling convention?
Upvotes: 2
Views: 852
Reputation: 73490
The __fastcall
is a calling convention.
It's a non standard feature : the double underscore at the begin of the name means that it's implementation specific. Calling conventions are tightly related to the systems and CPU architectures. This one seems to be relevant for x86 32 bit mode.
Some recommendations:
register
#define
in one of your header and make sure with conditional compilation that it's defined to nothing on platform/compilers where it's not relevant (for DLLs this approach is usual, with a library specific #define
). extern "C"
) because this is the only calling convention relevant semantic that is supported by the standard. Additional information:
Upvotes: 1