Bug 18466 - [3.4 regression] int ::i; accepted
[3.4 regression] int ::i; accepted
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: c++
4.0.0
: P2 normal
: 3.4.5
Assigned To: Volker Reichelt
http://gcc.gnu.org/ml/gcc-patches/200...
: accepts-invalid, monitored, patch
: 17421 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-11-13 18:58 UTC by Volker Reichelt
Modified: 2005-09-02 09:27 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-02-26 18:42:13


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2004-11-13 18:58:34 UTC
The C++ frontend accepts the following (IMHO invalid) variable declaration
since gcc 3.0:

=========================
int ::i;
=========================
Comment 1 Andrew Pinski 2004-11-13 19:02:13 UTC
Confirmed been failing since at least 2000-12-31.
Comment 2 CVS Commits 2004-11-25 17:12:09 UTC
Subject: Bug 18466

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-11-25 17:11:37

Modified files:
	gcc            : ChangeLog c-common.c c-common.h c-typeck.c 
	                 toplev.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/expr: unary2.C 
	gcc/testsuite/g++.dg/ext: lvaddr.C 
	gcc/testsuite/g++.dg/opt: pr7503-3.C 
	gcc/testsuite/g++.old-deja/g++.other: friend7.C 
	gcc/cp         : ChangeLog class.c cp-tree.h decl.c 
	                 name-lookup.c pt.c tree.c typeck.c 
Added files:
	gcc/testsuite/g++.dg/template: crash28.C 
	gcc/testsuite/g++.dg/expr: return1.C 
	gcc/testsuite/g++.dg/parse: qualified3.C 

Log message:
	PR c++/18001
	* c-common.h (lvalue_use): Move here from c-ctypeck.c.
	(lvalue_or_else): Declare.
	* c-common.c (lvalue_or_else): Move here from c-typeck.c.
	* c-typeck.c (lvalue_use): Remove.
	(lvalue_or_else): Remove.
	
	PR c++/18556
	* toplev.c (check_global_declarations): Set DECL_IGNORED_P on
	unemitted variables with static storage duration.
	
	PR c++/18445
	* class.c (instantiate_type): Treat NON_DEPENDENT_EXPRs with
	unknown_type as non matching.  Tidy up.
	* pt.c (build_non_dependent_expr): Do not build a
	NON_DEPENDENT_EXPR for a VAR_DECL.
	
	PR c++/18001
	* cp-tree.h (lvalue_or_else): Remove declaration.
	* tree.c (lvalue_or_else): Remove.
	* typeck.c (build_unary_op): Adjust call to lvalue_or_else.
	(build_modify_expr): Likewise.
	
	PR c++/18625
	* decl.c (duplicate_decls): Return error_mark_node on error, as
	specified.
	
	PR c++/18466
	* decl.c (grokvardecl): Keep track of whether or not a there was
	explicit qualification.
	* name-lookup.c (set_decl_namespace): Complain about explicit
	qualification of a name within its own namespace.
	
	PR c++/18545
	* typeck.c (check_return_expr): Robustify.
	
	PR c++/18445
	* g++.dg/template/crash28.C: Likewise.
	
	PR c++/18001
	* g++.dg/expr/unary2.C: Adjust lvalue messages.
	* g++.dg/ext/lvaddr.C: Likewise.
	* g++.dg/opt/pr7503-3.C: Likewise.
	
	PR c++/18466
	* g++.dg/parse/qualified3.C: New test.
	* g++.old-deja/g++.other/friend7.C: Remove bogus qualification.
	
	PR c++/18545
	* g++.dg/expr/return1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6549&r2=2.6550
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.587&r2=1.588
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.h.diff?cvsroot=gcc&r1=1.271&r2=1.272
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.400&r2=1.401
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/toplev.c.diff?cvsroot=gcc&r1=1.932&r2=1.933
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4648&r2=1.4649
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash28.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/return1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/unary2.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/lvaddr.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/pr7503-3.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/qualified3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.other/friend7.C.diff?cvsroot=gcc&r1=1.2&r2=1.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4498&r2=1.4499
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.689&r2=1.690
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1073&r2=1.1074
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1333&r2=1.1334
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.95&r2=1.96
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.948&r2=1.949
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&r1=1.419&r2=1.420
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.598&r2=1.599

Comment 3 Mark Mitchell 2004-11-25 17:40:09 UTC
Fixed in 4.0.
Comment 4 Volker Reichelt 2004-12-01 02:04:08 UTC
*** Bug 17421 has been marked as a duplicate of this bug. ***
Comment 5 Volker Reichelt 2005-09-02 07:34:34 UTC
Taking care of the backport to the 3.4 branch.
Comment 6 CVS Commits 2005-09-02 09:25:41 UTC
Subject: Bug 18466

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	reichelt@gcc.gnu.org	2005-09-02 09:25:13

Modified files:
	gcc/cp         : ChangeLog decl.c name-lookup.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.old-deja/g++.other: friend7.C decl5.C 

Log message:
	Backport:
	
	2004-11-25  Mark Mitchell  <mark@codesourcery.com>
	PR c++/18466
	* decl.c (grokvardecl): Keep track of whether or not a there was
	explicit qualification.
	* name-lookup.c (set_decl_namespace): Complain about explicit
	qualification of a name within its own namespace.
	
	* g++.dg/parse/qualified3.C: New test.
	* g++.old-deja/g++.other/friend7.C: Remove bogus qualification.
	
	2004-11-29  Ben Elliston  <bje@au.ibm.com>
	* g++.old-deja/g++.other/decl5.C: Remove remaining XFAILs.

Patches:
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.236&r2=1.3892.2.237
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1174.2.37&r2=1.1174.2.38
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.34.2.23&r2=1.34.2.24
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.428&r2=1.3389.2.429
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.other/friend7.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.2&r2=1.2.16.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.other/decl5.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.8&r2=1.8.10.1

Comment 7 Volker Reichelt 2005-09-02 09:27:46 UTC
Fixed also on the 3.4 branch.