Bug 58061

Summary: typedef in member's derived class causes crash when a class with the same name exists in the base class
Product: [Retired] Red Hat Linux Reporter: Arnold HEndriks <a.hendriks>
Component: gcc3Assignee: Jakub Jelinek <jakub>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: a.hendriks
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-02 18:18:30 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:

Description Arnold HEndriks 2002-01-07 15:15:39 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

Description of problem:
When class X has a (member) subclass that created a typedef, and this typedef 
has the same name as a class inside the base class of class X,
g++3 and g++ crash with an internal error

Version-Release number of selected component (if applicable):
arnold@bunny:~/develop $ rpm -q gcc-c++
gcc-c++-2.96-98
arnold@bunny:~/develop $ rpm -q gcc3-c++
gcc3-c++-3.0.1-3

How reproducible:
Always

Code to Reproduce:
struct Base
{
        class AutoReadLock { };
};
struct Standalone
{
        class AutoLock { };
        typedef AutoLock AutoReadLock;
};
struct Derived : Base
{
        struct LocalMember : public Standalone { };
        class AutoReadLock { };
};

Actual Results:  arnold@bunny:~/develop $ g++3 test.C
test.C:14: Internal compiler error in pop_binding, at cp/decl.c:1193


Expected Results:  An error at link time (because of the lack of main()), but no
compile time crash

Additional info:

Renaming the typedefs fixes the problem

Comment 1 Alan Cox 2002-12-15 19:03:17 UTC
Confirmed still present in 8.0


Comment 2 Richard Henderson 2004-10-02 18:18:30 UTC
Present in all versions up through 3.4; fixed in 4.0.  Pushed upstream to
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17795