User account creation filtered due to spam.

Bug 8727 - [3.2/3.3 regression] compiler confused by inheritance from an anonymous struct
Summary: [3.2/3.3 regression] compiler confused by inheritance from an anonymous struct
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2.1
: P3 normal
Target Milestone: ---
Assignee: Mark Mitchell
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2002-11-26 17:26 UTC by Joe Buck
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
bb.cxx (143 bytes, application/octet-stream)
2003-05-21 15:16 UTC, Joe Buck
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Buck 2002-11-26 17:26:00 UTC
This bug was reported by
jelenz@students.wisc.edu (John Lenz).

Attempting to inherit from a typedef'd anonymous struct seems
to confuse gcc (possibly in the generation of typeinfo or
virtual function tables).  The example given here works
with gcc-2.95.x and Red Hat's gcc 2.96, but fails with
gcc 3.0.x through gcc 3.2.1.

Release:
3.2.1

Environment:
i686-pc-linux-gnu

How-To-Repeat:
gcc -c bb.cxx
gives
bb.cxx:10: redefinition of `const char _ZTS4Heya[6]'
bb.cxx:10: `const char _ZTS4Heya[6]' previously defined here
Comment 2 Volker Reichelt 2002-11-27 09:05:32 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
    It also fails on mainline.
Comment 3 Mark Mitchell 2002-12-01 11:25:46 UTC
Responsible-Changed-From-To: unassigned->mmitchel
Responsible-Changed-Why: Working on a fix.
Comment 4 Mark Mitchell 2002-12-01 12:31:29 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in G++ 3.2.2/G++ 3.3.
Comment 5 Mark Mitchell 2002-12-01 20:27:37 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8727
Date: 1 Dec 2002 20:27:37 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2002-12-01 12:27:37
 
 Modified files:
 	gcc/cp         : ChangeLog cp-tree.h init.c rtti.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/inherit: typedef1.C typeinfo1.C 
 
 Log message:
 	PR c++/8727
 	* g++.dg/inherit/typeinfo1.C: New test.
 	
 	PR c++/8663
 	* g++.dg/inherit/typedef1.C: New test.
 	
 	PR c++/8727
 	* cp-tree.h (lang_type_class): Add typeinfo_var.
 	(CLASSTYPE_TYPEINFO_VAR): New macro.
 	* rtti.c (get_tinfo_decl): Use it.
 	
 	PR c++/8663
 	* init.c (expand_member_init): Always get the main variant of a
 	base class.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3061&r2=1.3062
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.771&r2=1.772
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&r1=1.298&r2=1.299
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/rtti.c.diff?cvsroot=gcc&r1=1.145&r2=1.146
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2243&r2=1.2244
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/typedef1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/typeinfo1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 6 Mark Mitchell 2002-12-01 20:27:37 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8727
Date: 1 Dec 2002 20:27:37 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2002-12-01 12:27:37
 
 Modified files:
 	gcc/cp         : ChangeLog cp-tree.h init.c rtti.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/inherit: typedef1.C typeinfo1.C 
 
 Log message:
 	PR c++/8727
 	* g++.dg/inherit/typeinfo1.C: New test.
 	
 	PR c++/8663
 	* g++.dg/inherit/typedef1.C: New test.
 	
 	PR c++/8727
 	* cp-tree.h (lang_type_class): Add typeinfo_var.
 	(CLASSTYPE_TYPEINFO_VAR): New macro.
 	* rtti.c (get_tinfo_decl): Use it.
 	
 	PR c++/8663
 	* init.c (expand_member_init): Always get the main variant of a
 	base class.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3061&r2=1.3062
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.771&r2=1.772
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&r1=1.298&r2=1.299
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/rtti.c.diff?cvsroot=gcc&r1=1.145&r2=1.146
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2243&r2=1.2244
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/typedef1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/typeinfo1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 7 Mark Mitchell 2002-12-01 20:40:38 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8727
Date: 1 Dec 2002 20:40:38 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	mmitchel@gcc.gnu.org	2002-12-01 12:40:38
 
 Modified files:
 	gcc/cp         : ChangeLog cp-tree.h init.c rtti.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/inherit: typedef1.C typeinfo1.C 
 
 Log message:
 	PR c++/8727
 	* g++.dg/inherit/typeinfo1.C: New test.
 	
 	PR c++/8663
 	* g++.dg/inherit/typedef1.C: New test.
 	
 	PR c++/8727
 	* cp-tree.h (lang_type_class): Add typeinfo_var.
 	(CLASSTYPE_TYPEINFO_VAR): New macro.
 	* rtti.c (get_tinfo_decl): Use it.
 	
 	PR c++/8663
 	* init.c (expand_member_init): Always get the main variant of a
 	base class.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.46&r2=1.2685.2.114.2.47
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.681.2.12.2.9&r2=1.681.2.12.2.10
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.264.2.12.2.2&r2=1.264.2.12.2.3
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/rtti.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.130.6.2&r2=1.130.6.3
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.61&r2=1.1672.2.166.2.62
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/typedef1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/typeinfo1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1
 

Comment 8 Mark Mitchell 2002-12-01 20:40:38 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8727
Date: 1 Dec 2002 20:40:38 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	mmitchel@gcc.gnu.org	2002-12-01 12:40:38
 
 Modified files:
 	gcc/cp         : ChangeLog cp-tree.h init.c rtti.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/inherit: typedef1.C typeinfo1.C 
 
 Log message:
 	PR c++/8727
 	* g++.dg/inherit/typeinfo1.C: New test.
 	
 	PR c++/8663
 	* g++.dg/inherit/typedef1.C: New test.
 	
 	PR c++/8727
 	* cp-tree.h (lang_type_class): Add typeinfo_var.
 	(CLASSTYPE_TYPEINFO_VAR): New macro.
 	* rtti.c (get_tinfo_decl): Use it.
 	
 	PR c++/8663
 	* init.c (expand_member_init): Always get the main variant of a
 	base class.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.46&r2=1.2685.2.114.2.47
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.681.2.12.2.9&r2=1.681.2.12.2.10
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.264.2.12.2.2&r2=1.264.2.12.2.3
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/rtti.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.130.6.2&r2=1.130.6.3
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.61&r2=1.1672.2.166.2.62
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/typedef1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/inherit/typeinfo1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1