https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63650
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Status|WAITING |RESOLVED Known to fail| |12.0, 5.1.0 Resolution|--- |INVALID --- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> --- To summarize here is the full testcase which can be used even to test under MSVC: #ifdef __GNUC__ #ifndef CDECL #define CDECL __attribute__((regparm(0),cdecl)) #endif #else #define CDECL __cdecl #endif class A { virtual int CDECL foo( void *nok) = 0; }; class B : public A { int foo(void *nok); /* implicitly virtual */ }; ---- CUT --- Note MSVC also rejects this code as invalid: <source>(16): error C2695: 'B::foo': overriding virtual function differs from 'A::foo' only by calling convention <source>(11): note: see declaration of 'A::foo' so I think GCC is correct, you need the CDECL on the foo when overriding the virtual function too. why clang and ICC accepts it, I have no idea maybe ask them.