Red Hat Bugzilla – Bug 59766
g++ wrong virtual function in template base class destructor
Last modified: 2007-04-18 12:40:22 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.12; Mac_PowerPC)
Description of problem:
In the case of a base class which is an instance of a template, if its
destructor invokes a virtual member function which was overridden by a
more derived class, that override is invoked instead of the base class's
own member function. This violates the C++ standard (12.7.3). This
bug appears to be specific to the 2.96-series of RedHat compilers.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Compile and run the attached C++ program.
Actual Results: The string "DerivedClass Close() invoked, BROKEN!" is
Expected Results: The string "BaseClass Close() invoked, CORRECT!"
should be printed.
The bug is not present in RH6.2, is present in 7.1, and 7.2. 7.0 not tested.
Created attachment 45440 [details]
gcc 3.0-3.0.2 had the same bug, fixed by Jason Merrill in December last year.
Should be fixed in gcc-2.96-103, currently at
An errata has been issued which should help the problem described in this bug report.
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen
this bug report if the solution does not work for you.