c++/6006: problem with pure virtual functions and destructord
lerdsuwa@gcc.gnu.org
lerdsuwa@gcc.gnu.org
Tue May 14 08:46:00 GMT 2002
Synopsis: problem with pure virtual functions and destructord
State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Tue May 14 08:46:22 2002
State-Changed-Why:
Not a bug. The virtual function is treated as non-virtual
inside destructors. So ~A() can only call A::f() which is
pure virtual. Here is the relevant part of the standard
[section 12.7 para 3]
... When a virtual function is called directly or indirectly
from a constructor (including from the mem-initializer for a
data member) or from a destructor, and the object to which
the call applies is the object under construction or destruction,
the function called is the one defined in the constructor or
destructor's own class or in one of its base, but not a function
overriding it in a class derived from the constructor or
destructor's class, or overriding it in one of the other
base classes of the most derived object (1.8).
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6006
More information about the Gcc-bugs
mailing list