Virtual operator= bug
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Tue Aug 31 22:45:00 GMT 1999
> If operator= is defined as a pure virtual function in a base class and
> defined in a derived class gcc-2.95 and 2.95.1 (at least) generate an
> undefined
> refercnce error. If in the exact same code one replaces everywhere
> operator= by operator+= no errors are generated.
Thanks for your bug report. However, it is an error in your code, not
in g++. The assignment
e = d;
invokes the copy-assignment operator, which is implicitly declared
(12.8/10). According to 12.8/13, the implict definition of class D
invokes the copy-assignment operator of class B (which is pure
virtual, but can still be called when qualified). Since that is not
defined, you get the linker error.
Hope this helps,
Martin
More information about the Gcc-bugs
mailing list