public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13377] New: unexpected behavior of namespace usage directive
@ 2003-12-10 17:18 boris at kolpackov dot net
  2003-12-10 17:44 ` [Bug c++/13377] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: boris at kolpackov dot net @ 2003-12-10 17:18 UTC (permalink / raw)
  To: gcc-bugs

$ cat > test.cpp
namespace N1
{
  namespace N2
  {
  }
}

namespace N2
{
}

using namespace N1;
using namespace N2;

$ g++ --version
g++ (GCC) 3.3.2 (Debian)
$ g++ -c test.cpp
test.cpp:13: error: `<type error>' is not a namespace
$

-- 
           Summary: unexpected behavior of namespace usage directive
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: boris at kolpackov dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-debian-gnu/linux
  GCC host triplet: i386-debian-gnu/linux
GCC target triplet: i386-debian-gnu/linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13377


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13377] unexpected behavior of namespace usage directive
  2003-12-10 17:18 [Bug c++/13377] New: unexpected behavior of namespace usage directive boris at kolpackov dot net
@ 2003-12-10 17:44 ` pinskia at gcc dot gnu dot org
  2005-08-29 13:37 ` reichelt at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-10 17:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-10 17:44 -------
Related to bug 12272.
Confirmed.
The error message on the mainline:
pr13377.cc:13: error: expected namespace-name
pr13377.cc:13: error: `<type error>' is not a namespace


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2003-12-10 17:44:06
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13377


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13377] unexpected behavior of namespace usage directive
  2003-12-10 17:18 [Bug c++/13377] New: unexpected behavior of namespace usage directive boris at kolpackov dot net
  2003-12-10 17:44 ` [Bug c++/13377] " pinskia at gcc dot gnu dot org
@ 2005-08-29 13:37 ` reichelt at gcc dot gnu dot org
  2005-08-31 10:33 ` reichelt at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-08-29 13:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-08-29 13:32 -------
Testing a patch.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |reichelt at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13377


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13377] unexpected behavior of namespace usage directive
  2003-12-10 17:18 [Bug c++/13377] New: unexpected behavior of namespace usage directive boris at kolpackov dot net
  2003-12-10 17:44 ` [Bug c++/13377] " pinskia at gcc dot gnu dot org
  2005-08-29 13:37 ` reichelt at gcc dot gnu dot org
@ 2005-08-31 10:33 ` reichelt at gcc dot gnu dot org
  2005-08-31 10:54 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-08-31 10:33 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 13377 depends on bug 23586, which changed state.

Bug 23586 Summary: [3.4 regression] Bad diagnostic for invalid namespace-name
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23586

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13377


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13377] unexpected behavior of namespace usage directive
  2003-12-10 17:18 [Bug c++/13377] New: unexpected behavior of namespace usage directive boris at kolpackov dot net
                   ` (2 preceding siblings ...)
  2005-08-31 10:33 ` reichelt at gcc dot gnu dot org
@ 2005-08-31 10:54 ` cvs-commit at gcc dot gnu dot org
  2005-08-31 11:04 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-31 10:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-31 10:33 -------
Subject: Bug 13377

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	reichelt@gcc.gnu.org	2005-08-31 10:32:54

Modified files:
	gcc/cp         : ChangeLog parser.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/tc1: dr101.C 
Added files:
	gcc/testsuite/g++.dg/lookup: ambig4.C ambig5.C 

Log message:
	PR c++/13377
	* parser.c (cp_parser_lookup_name): Pass LOOKUP_COMPLAIN to
	lookup_name_real on final parse.
	
	* g++.dg/lookup/ambig4.C: New test.
	* g++.dg/lookup/ambig5.C: New test.
	* g++.dg/tc1/dr101.C: Adjust error markers.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4864&r2=1.4865
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.352&r2=1.353
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5985&r2=1.5986
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ambig4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ambig5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/tc1/dr101.C.diff?cvsroot=gcc&r1=1.2&r2=1.3



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13377


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13377] unexpected behavior of namespace usage directive
  2003-12-10 17:18 [Bug c++/13377] New: unexpected behavior of namespace usage directive boris at kolpackov dot net
                   ` (3 preceding siblings ...)
  2005-08-31 10:54 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-31 11:04 ` cvs-commit at gcc dot gnu dot org
  2005-08-31 11:21 ` [Bug c++/13377] [3.4 regression] " reichelt at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-31 11:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-31 10:54 -------
Subject: Bug 13377

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	reichelt@gcc.gnu.org	2005-08-31 10:54:35

Modified files:
	gcc/cp         : ChangeLog parser.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/tc1: dr101.C 
Added files:
	gcc/testsuite/g++.dg/lookup: ambig4.C ambig5.C 

Log message:
	PR c++/13377
	* parser.c (cp_parser_lookup_name): Pass LOOKUP_COMPLAIN to
	lookup_name_real on final parse.
	
	* g++.dg/lookup/ambig4.C: New test.
	* g++.dg/lookup/ambig5.C: New test.
	* g++.dg/tc1/dr101.C: Adjust error markers.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.87&r2=1.4648.2.88
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.319.2.13&r2=1.319.2.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.363&r2=1.5084.2.364
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ambig4.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ambig5.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/tc1/dr101.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.2&r2=1.2.58.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13377


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13377] [3.4 regression] unexpected behavior of namespace usage directive
  2003-12-10 17:18 [Bug c++/13377] New: unexpected behavior of namespace usage directive boris at kolpackov dot net
                   ` (4 preceding siblings ...)
  2005-08-31 11:04 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-31 11:21 ` reichelt at gcc dot gnu dot org
  2005-09-01 11:32 ` cvs-commit at gcc dot gnu dot org
  2005-09-01 11:33 ` reichelt at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-08-31 11:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-08-31 11:07 -------
For the testcase

  ==================================
  namespace N
  {
    int i;
  }

  int i;

  using namespace N;

  void foo() { i; }
  ==================================

we now get

  ambig4.C: In function 'void foo()':
  ambig4.C:10: error: use of 'i' is ambiguous
  ambig4.C:6: error:   first declared as 'int i' here
  ambig4.C:3: error:   also declared as 'int N::i' here
  ambig4.C:10: error: 'i' was not declared in this scope

Btw, this is the testcase which was a regression from GCC 3.3.x.

For the testcase

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

  namespace M {}

  using namespace N;
  using namespace M;
  ==================================

we now get (since the patch for PR23586 is also in place):

  ambig5.C:13: error: use of 'M' is ambiguous
  ambig5.C:10: error:   first declared as 'namespace M { }' here
  ambig5.C:7: error:   also declared as 'namespace M { }' here
  ambig5.C:13: error: 'M' is not a namespace-name
  ambig5.C:13: error: expected namespace-name before ';' token

This is still a little suboptimal (first we say it's ambiguous,
then we say it's not declared/not a namespace-name), but I think
the user can figure out the problem now.

So this is fixed on mainline and the 4.0 branch.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2005-
                   |                            |08/msg01717.html
            Summary|unexpected behavior of      |[3.4 regression] unexpected
                   |namespace usage directive   |behavior of namespace usage
                   |                            |directive
   Target Milestone|---                         |3.4.5


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13377


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13377] [3.4 regression] unexpected behavior of namespace usage directive
  2003-12-10 17:18 [Bug c++/13377] New: unexpected behavior of namespace usage directive boris at kolpackov dot net
                   ` (5 preceding siblings ...)
  2005-08-31 11:21 ` [Bug c++/13377] [3.4 regression] " reichelt at gcc dot gnu dot org
@ 2005-09-01 11:32 ` cvs-commit at gcc dot gnu dot org
  2005-09-01 11:33 ` reichelt at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-09-01 11:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-09-01 11:32 -------
Subject: Bug 13377

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	reichelt@gcc.gnu.org	2005-09-01 11:32:20

Modified files:
	gcc/cp         : ChangeLog parser.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/lookup: ambig4.C ambig5.C 

Log message:
	PR c++/13377
	* parser.c (cp_parser_lookup_name): Pass LOOKUP_COMPLAIN to
	lookup_name_real on final parse.
	
	* g++.dg/lookup/ambig4.C: New test.
	* g++.dg/lookup/ambig5.C: New test.

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.231&r2=1.3892.2.232
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.59&r2=1.157.2.60
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.422&r2=1.3389.2.423
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ambig4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.6.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/ambig5.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.6.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13377


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/13377] [3.4 regression] unexpected behavior of namespace usage directive
  2003-12-10 17:18 [Bug c++/13377] New: unexpected behavior of namespace usage directive boris at kolpackov dot net
                   ` (6 preceding siblings ...)
  2005-09-01 11:32 ` cvs-commit at gcc dot gnu dot org
@ 2005-09-01 11:33 ` reichelt at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-09-01 11:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-09-01 11:33 -------
Fixed on the 3.4 branch, too.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13377


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-09-01 11:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-10 17:18 [Bug c++/13377] New: unexpected behavior of namespace usage directive boris at kolpackov dot net
2003-12-10 17:44 ` [Bug c++/13377] " pinskia at gcc dot gnu dot org
2005-08-29 13:37 ` reichelt at gcc dot gnu dot org
2005-08-31 10:33 ` reichelt at gcc dot gnu dot org
2005-08-31 10:54 ` cvs-commit at gcc dot gnu dot org
2005-08-31 11:04 ` cvs-commit at gcc dot gnu dot org
2005-08-31 11:21 ` [Bug c++/13377] [3.4 regression] " reichelt at gcc dot gnu dot org
2005-09-01 11:32 ` cvs-commit at gcc dot gnu dot org
2005-09-01 11:33 ` reichelt at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).