Bug 18093 - [3.4/4.0 regression] bogus conflict in namespace aliasing
Summary: [3.4/4.0 regression] bogus conflict in namespace aliasing
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.2
: P2 normal
Target Milestone: 3.4.3
Assignee: Mark Mitchell
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2004-10-20 22:39 UTC by Boris Kolpackov
Modified: 2004-10-27 04:33 UTC (History)
1 user (show)

See Also:
Host: i686-linux
Target: i686-linux
Build: i686-linux
Known to work: 3.3.4
Known to fail: 3.4.2 3.4.3 4.0.0
Last reconfirmed: 2004-10-20 22:52:04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Boris Kolpackov 2004-10-20 22:39:38 UTC
$ cat >test.cxx 
namespace m
{
  namespace n
  {
  }
}

namespace n
{
}

namespace o
{
  namespace n = ::m::n;
}

$ g++-3.4 test.cxx 
test.cxx:14: error: declaration of `namespace n' conflicts with
test.cxx:9: error: previous declaration of `namespace n' here

BTW, this bug in combination with #16468 (
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16468 ) makes any non-trivial use of
c++ namespaces in g++ 3.4, well, really non-trivial. Good job. Cheers!
Comment 1 Wolfgang Bangerth 2004-10-20 22:52:04 UTC
Confirmed. A regression in 3.4 and mainline over 3.3. 
W. 
Comment 2 Andrew Pinski 2004-10-20 23:32:32 UTC
: Search converges between 2003-12-18-trunk (#431) and 2003-12-24-trunk (#432).

Note we just to ICE before also, this is the date which the ICE was fixed:
: Search converges between 2004-08-01-trunk (#501) and 2004-08-02-trunk (#502).
Comment 3 Andrew Pinski 2004-10-20 23:41:28 UTC
Note this is related to PR 11762.
Comment 4 GCC Commits 2004-10-27 02:23:22 UTC
Subject: Bug 18093

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-10-27 02:23:16

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog decl.c name-lookup.c parser.c pt.c 
	                 search.c typeck.c 
Added files:
	gcc/testsuite/g++.dg/lookup: ns2.C 
	gcc/testsuite/g++.dg/template: enum4.C expr1.C 

Log message:
	PR c++/18093
	* search.c (current_scope): Return the innermost non-block scope,
	not the innermost non-block, non-namespace scope.
	(at_namespace_scope_p): Adjust accordingly.
	(dfs_accessible_post): Do not pass namespaces to is_friend.
	(dfs_walk_once_accessible_r): Likewise.
	* decl.c (grokvardecl): Adjust call to current_scope.
	(build_enumerator): Likewise.
	* parser.c (cp_parser_using_declaration): Likewise.
	(cp_parser_direct_declarator): Use at_namespace_scope_p instead of
	current_scope.
	(cp_parser_class_head): Adjust call to current_scope.
	* name-lookup.c (do_namespace_alias): Set the DECL_CONTEXT for the
	alias.
	
	PR c++/18020
	* pt.c (tusbst_copy_and_build): Resolve enumeration constants to
	their underlying values.
	
	PR c++/18161
	* typeck.c (build_binary_op): Honor build_type, even when in a
	template.
	
	PR c++/18093
	* g++.dg/lookup/ns2.C: New test.
	
	PR c++/18020
	* g++.dg/template/enum4.C: New test.
	
	PR c++/18161
	* g++.dg/template/expr1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4501&r2=1.4502
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4454&r2=1.4455
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1318&r2=1.1319
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.87&r2=1.88
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.270&r2=1.271
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.937&r2=1.938
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&r1=1.335&r2=1.336
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.588&r2=1.589
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ns2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/enum4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/expr1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 5 GCC Commits 2004-10-27 04:33:08 UTC
Subject: Bug 18093

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-10-27 04:32:57

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog name-lookup.c pt.c 
Added files:
	gcc/testsuite/g++.dg/lookup: ns2.C 
	gcc/testsuite/g++.dg/template: enum4.C 

Log message:
	PR c++/18093
	* search.c (current_scope): Return the innermost non-block scope,
	not the innermost non-block, non-namespace scope.
	(at_namespace_scope_p): Adjust accordingly.
	(dfs_accessible_post): Do not pass namespaces to is_friend.
	(dfs_walk_once_accessible_r): Likewise.
	* decl.c (grokvardecl): Adjust call to current_scope.
	(build_enumerator): Likewise.
	* parser.c (cp_parser_using_declaration): Likewise.
	(cp_parser_direct_declarator): Use at_namespace_scope_p instead of
	current_scope.
	(cp_parser_class_head): Adjust call to current_scope.
	* name-lookup.c (do_namespace_alias): Set the DECL_CONTEXT for the
	alias.
	
	PR c++/18020
	* pt.c (tusbst_copy_and_build): Resolve enumeration constants to
	their underlying values.
	
	PR c++/18093
	* g++.dg/lookup/ns2.C: New test.
	
	PR c++/18020
	* g++.dg/template/enum4.C: New test.

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.297&r2=1.3389.2.298
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ns2.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++.dg/template/enum4.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/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.171&r2=1.3892.2.172
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.18&r2=1.34.2.19
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.43&r2=1.816.2.44

Comment 6 Mark Mitchell 2004-10-27 04:33:41 UTC
Fixed in GCC 3.4.3.