Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 14668
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Mark Mitchell <mark@codesourcery.com>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: Pawel Sikora <pluto@agmk.net>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 14668 depends on: Show dependency tree
Show dependency graph
Bug 14668 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: 2004-03-25 04:47 Opened: 2004-03-21 13:09
class A {}; 
class B { 
  static A *A; 
}; 
A *B::A = 0; 
 
g++3.4-20040317 compiles code without errors. 
g++3.3 reports error: declaration of `A*B::A' changes meaning of `A' from 
`class A' 
 
which behavior is correct?

------- Comment #1 From Gabriel Dos Reis 2004-03-21 15:13 -------
Subject: Re:  New: declaration of `A*B::A' changes meaning of `A' from `class
A'...

"pluto at ds14 dot agh dot edu dot pl" <gcc-bugzilla@gcc.gnu.org> writes:

| class A {}; 
| class B { 
|   static A *A; 
| }; 
| A *B::A = 0; 
|  
| g++3.4-20040317 compiles code without errors. 
| g++3.3 reports error: declaration of `A*B::A' changes meaning of `A' from 
| `class A' 
|  
| which behavior is correct?

The code is ill-formed.  No diagnostic is required.  GCC used to
diagnose that in the past.  This is a regression.  I would think it is
a serious one (a frequent mistake).

-- Gaby

------- Comment #2 From Wolfgang Bangerth 2004-03-24 23:23 -------
Hm, I may be blind today, but I fail to see what may be wrong with this 
code? (Clearly the initialization of the member has nothing to do with 
the problem here.) Gaby, do you refer to the "after declaration, reevaluate 
the declaration with the newly defined name and see whether it is still 
valid" rule? Or what do you refer to in saying that the code is invalid? 
 
W. 

------- Comment #3 From Gabriel Dos Reis 2004-03-25 00:22 -------
Subject: Re:  [3.4/3.5 Regression] declaration of `A*B::A' changes meaning of
`A' from `class A'...

"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| Hm, I may be blind today, but I fail to see what may be wrong with this 
| code? (Clearly the initialization of the member has nothing to do with 
| the problem here.)

Yes, I was not talking about the initialization.

| Gaby, do you refer to the "after declaration, reevaluate 
| the declaration with the newly defined name and see whether it is still 
| valid" rule? 

Yes, that is the one I was referring to.

-- Gaby

------- Comment #4 From Wolfgang Bangerth 2004-03-25 04:47 -------
OK, this is most likely a regression with the new parser then. 
Thanks 
W. 

------- Comment #5 From Mark Mitchell 2004-05-24 02:47 -------
Working on a fix.

------- Comment #6 From CVS Commits 2004-05-28 20:12 -------
Subject: Bug 14668

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-05-28 20:12:12

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog parser.c 
	gcc/testsuite/g++.old-deja/g++.benjamin: tem04.C 
Added files:
	gcc/testsuite/g++.dg/lookup: redecl1.C 

Log message:
	PR c++/14668
	* parser.c (cp_parser_simple_type_specifier): Call
	maybe_note_name_used_in_class.
	
	PR c++/14668
	* g++.dg/lookup/redecl1.C: New test.
	* g++.old-deja/g++.benjamin/tem04.C: Add error marker.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.184&r2=1.3389.2.185
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.106&r2=1.3892.2.107
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.157.2.28&r2=1.157.2.29
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/redecl1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.7&r2=1.7.16.1


------- Comment #7 From CVS Commits 2004-05-28 20:16 -------
Subject: Bug 14668

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-05-28 20:16:03

Modified files:
	gcc/cp         : parser.c 
	gcc/testsuite/g++.old-deja/g++.benjamin: tem04.C 
Added files:
	gcc/testsuite/g++.dg/lookup: redecl1.C 

Log message:
	PR c++/14668
	* parser.c (cp_parser_simple_type_specifier): Call
	maybe_note_name_used_in_class.
	
	PR c++/14668
	* g++.dg/lookup/redecl1.C: New test.
	* g++.old-deja/g++.benjamin/tem04.C: Add error marker.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.195&r2=1.196
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/redecl1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C.diff?cvsroot=gcc&r1=1.7&r2=1.8


------- Comment #8 From CVS Commits 2004-05-28 20:17 -------
Subject: Bug 14668

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-05-28 20:17:22

Modified files:
	gcc/cp         : ChangeLog 
	gcc/testsuite  : ChangeLog 

Log message:
	PR c++/14668
	* parser.c (cp_parser_simple_type_specifier): Call
	maybe_note_name_used_in_class.
	
	PR c++/14668
	* g++.dg/lookup/redecl1.C: New test.
	* g++.old-deja/g++.benjamin/tem04.C: Add error marker.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4062&r2=1.4063
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3785&r2=1.3786


------- Comment #9 From Mark Mitchell 2004-05-28 20:18 -------
Fixed in GCC 3.4.1.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug