ambiguity in operator delete

Alexander Zvyagin zvyagin@gams.ihep.su
Mon Oct 18 01:09:00 GMT 1999


Dear GCC developers,

I have problem with this simple code (under gcc-2.95.1) file b.c:
class A                  { public: void operator delete (void *ptr); };
class N: public A                       {};
class C1: virtual public A              { public: ~C1(); };
class C2: public C1, virtual public N   { public: ~C2(); };
C2::~C2(){}

$ g++ -c b.c
b.c: In method `C2::~C2()':
b.c:5: request for member `operator delete' is ambiguous
b.c:1: candidates are: static void A::operator delete(void *)
b.c:1:                 static void A::operator delete(void *)

Even if my code contains some ambiguity (I do not understand why, I
belive that objects derived from class A must be deleted via A::operator
delete) GCC prints IDENTICAL operators that caused the ambiguity!

With best wishes,
Alexander Zvyagin.



More information about the Gcc-bugs mailing list