Bug 32898

Summary: [4.2/4.3 regression] Definition of variable N::i outside namespace N not rejected
Product: gcc Reporter: Volker Reichelt <reichelt>
Component: c++Assignee: Jakub Jelinek <jakub>
Status: RESOLVED FIXED    
Severity: normal CC: fang, gcc-bugs
Priority: P2 Keywords: accepts-invalid
Version: 4.3.0   
Target Milestone: 4.2.2   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2007-08-22 16:20:56

Description Volker Reichelt 2007-07-25 21:56:23 UTC
The following invalid code snippet is accepted since GCC 4.2.0:

=================
namespace N { }

int N::i;
=================
Comment 1 Andrew Pinski 2007-08-06 15:53:49 UTC
Confirmed.
Comment 2 Jakub Jelinek 2007-08-22 16:20:56 UTC
Testing a fix.
Comment 3 Jakub Jelinek 2007-08-23 23:27:47 UTC
Subject: Bug 32898

Author: jakub
Date: Thu Aug 23 23:27:34 2007
New Revision: 127749

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127749
Log:
	PR c++/32898
	* name-lookup.c (set_decl_namespace): lookup_qualified_name failure
	is error_mark_node rather than NULL_TREE.
	* pt.c (check_explicit_specialization): Likewise.

	* g++.dg/lookup/ns3.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/lookup/ns3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/name-lookup.c
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Jakub Jelinek 2007-08-24 17:10:08 UTC
Subject: Bug 32898

Author: jakub
Date: Fri Aug 24 17:09:50 2007
New Revision: 127777

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127777
Log:
	PR c++/32898
	* name-lookup.c (set_decl_namespace): lookup_qualified_name failure
	is error_mark_node rather than NULL_TREE.
	* pt.c (check_explicit_specialization): Likewise.

	* g++.dg/lookup/ns3.C: New test.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/lookup/ns3.C
Modified:
    branches/gcc-4_2-branch/gcc/cp/ChangeLog
    branches/gcc-4_2-branch/gcc/cp/name-lookup.c
    branches/gcc-4_2-branch/gcc/cp/pt.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog

Comment 5 Jakub Jelinek 2007-08-24 17:25:04 UTC
Fixed.