Bug 59766

Summary: g++ wrong virtual function in template base class destructor
Product: [Retired] Red Hat Linux Reporter: Jim Rees <jimrees>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-07-26 21:47:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
reproducer program none

Description Jim Rees 2002-02-12 22:08:11 UTC
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):





How reproducible:

Always



Steps to Reproduce:

Compile and run the attached C++ program.



Actual Results:  The string "DerivedClass Close() invoked, BROKEN!" is 
printed.



Expected Results:  The string "BaseClass Close() invoked, CORRECT!" 
should be printed.



Additional info:



The bug is not present in RH6.2, is present in 7.1, and 7.2.  7.0 not tested.

Comment 1 Jim Rees 2002-02-12 22:09:55 UTC
Created attachment 45440 [details]
reproducer program

Comment 2 Jakub Jelinek 2002-02-14 23:12:20 UTC
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
ftp://people.redhat.com/jakub/gcc/2.96-103/

Comment 3 Bill Nottingham 2002-07-26 21:47:28 UTC
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.

http://rhn.redhat.com/errata/RHBA-2002-055.html