public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11762] New: namespace aliasing ICE in warn_extern_redeclared_static
@ 2003-08-01 15:45 bkoz at gcc dot gnu dot org
  2003-08-01 15:53 ` [Bug c++/11762] " pinskia at physics dot uc dot edu
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2003-08-01 15:45 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: namespace aliasing ICE in warn_extern_redeclared_static
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bkoz at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: x86/linux

compiling the bit below gives:

%g++ -c namespace_issues_2.cc
namespace_issues_2.cc:36: error: conflicting types for `std'
<internal>:0: error: previous declaration as `std'
namespace_issues_2.cc:36: internal compiler error: tree check: expected
   var_decl, have namespace_decl in warn_extern_redeclared_static, at cp/decl.c
   :2827
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

but with icc gives:


%icc -c namespace_issues_2.cc
namespace_issues_2.cc(40): error: "std" has already been declared in the current
scope
  namespace std
            ^
 
namespace_issues_2.cc(40): error: "std" has already been declared in the current
scope
  namespace std
            ^
 
namespace_issues_2.cc(43): error: vector is not a template
       class vector<useless>
             ^
 
namespace_issues_2.cc(52): error: namespace "std" has no member "vector"
    std::vector<useless> v;
         ^
 
namespace_issues_2.cc(52): error: type name is not allowed
    std::vector<useless> v;
                ^
 
namespace_issues_2.cc(52): error: identifier "v" is undefined
    std::vector<useless> v;
                         ^
 
compilation aborted for namespace_issues_2.cc (code 2)

Anyway. Here goes the offending code.

// specialization error

#ifdef _GLIBCXX_DEBUG
  #define _GLIBCXX_NAMESPACE_STD __gnu_debug
#else
  #define _GLIBCXX_NAMESPACE_STD __gnu_release
#endif

namespace __gnu_debug
{
  template<typename _T>
  class vector
  {
  public:
    int foo() { return 5; }
  };
}

namespace __gnu_release
{
  template<typename _T>
  class vector
  {
  public:
    int foo() { return 6; }
  };
}

#if 0
namespace std
{
  using _GLIBCXX_NAMESPACE_STD::vector;
}
#else
// XXX Cannot re-open for specialization below.
namespace std = _GLIBCXX_NAMESPACE_STD;
#endif

struct useless { };

namespace std 
{
   template<>
     class vector<useless> 
     { 
     public:
       int foo() { return 7; }
     };
}

int main()
{
  std::vector<useless> v;
  int i = v.foo();

  return 0;
}


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

* [Bug c++/11762] namespace aliasing ICE in warn_extern_redeclared_static
  2003-08-01 15:45 [Bug c++/11762] New: namespace aliasing ICE in warn_extern_redeclared_static bkoz at gcc dot gnu dot org
@ 2003-08-01 15:53 ` pinskia at physics dot uc dot edu
  2003-08-01 15:57 ` gdr at integrable-solutions dot net
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-01 15:53 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   GCC host triplet|x86/linux                   |
           Keywords|                            |ice-on-invalid-code
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-01 15:53:00
               date|                            |


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-01 15:53 -------
I can confirm this on the mainline (20030730).
Note this does not ICE with checking disabled.


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

* [Bug c++/11762] namespace aliasing ICE in warn_extern_redeclared_static
  2003-08-01 15:45 [Bug c++/11762] New: namespace aliasing ICE in warn_extern_redeclared_static bkoz at gcc dot gnu dot org
  2003-08-01 15:53 ` [Bug c++/11762] " pinskia at physics dot uc dot edu
@ 2003-08-01 15:57 ` gdr at integrable-solutions dot net
  2003-08-23  1:04 ` dhazeghi at yahoo dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: gdr at integrable-solutions dot net @ 2003-08-01 15:57 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From gdr at integrable-solutions dot net  2003-08-01 15:57 -------
Subject: Re:  New: namespace aliasing ICE in warn_extern_redeclared_static


[...]

| #if 0
| namespace std
| {
|   using _GLIBCXX_NAMESPACE_STD::vector;
| }
| #else
| // XXX Cannot re-open for specialization below.
| namespace std = _GLIBCXX_NAMESPACE_STD;
| #endif

Benjamin,

While the ICE is definitely a bug in the compiler, we cannot write

   namesapce std = whatever;

because ::std is treated magically in the compiler, that is, before we
start parsing inputs, we (in front end, I mean) magically declare std as
an orignal nameespace  -- and we put there many stuff.

I'll, however, take care of this issue.

-- Gaby


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

* [Bug c++/11762] namespace aliasing ICE in warn_extern_redeclared_static
  2003-08-01 15:45 [Bug c++/11762] New: namespace aliasing ICE in warn_extern_redeclared_static bkoz at gcc dot gnu dot org
  2003-08-01 15:53 ` [Bug c++/11762] " pinskia at physics dot uc dot edu
  2003-08-01 15:57 ` gdr at integrable-solutions dot net
@ 2003-08-23  1:04 ` dhazeghi at yahoo dot com
  2003-08-29 11:31 ` gdr at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-23  1:04 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


dhazeghi at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |---


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

* [Bug c++/11762] namespace aliasing ICE in warn_extern_redeclared_static
  2003-08-01 15:45 [Bug c++/11762] New: namespace aliasing ICE in warn_extern_redeclared_static bkoz at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2003-08-23  1:04 ` dhazeghi at yahoo dot com
@ 2003-08-29 11:31 ` gdr at gcc dot gnu dot org
  2003-09-07 18:53 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: gdr at gcc dot gnu dot org @ 2003-08-29 11:31 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2003-08-01 15:53:00         |2003-08-29 11:30:59
               date|                            |


------- Additional Comments From gdr at gcc dot gnu dot org  2003-08-29 11:30 -------
Patching.


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

* [Bug c++/11762] namespace aliasing ICE in warn_extern_redeclared_static
  2003-08-01 15:45 [Bug c++/11762] New: namespace aliasing ICE in warn_extern_redeclared_static bkoz at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2003-08-29 11:31 ` gdr at gcc dot gnu dot org
@ 2003-09-07 18:53 ` cvs-commit at gcc dot gnu dot org
  2003-09-07 19:50 ` gdr at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-09-07 18:53 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-09-07 18:52 -------
Subject: Bug 11762

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	gdr@gcc.gnu.org	2003-09-07 18:52:53

Modified files:
	gcc            : ChangeLog c-pretty-print.h c-pretty-print.c 
	gcc/testsuite/g++.dg/lookup: struct1.C 
	gcc/cp         : ChangeLog cxx-pretty-print.c decl.c error.c 

Log message:
	* c-pretty-print.h (pp_c_left_brace): Declare.
	(pp_c_right_brace): Likewise.
	* c-pretty-print.c (pp_c_left_brace): Now a function
	(pp_c_right_brace): Likewise.
	
	cp/
	PR c++/11762
	* error.c (dump_decl): Handle namespace-alias-definition.
	* decl.c (warn_extern_redeclared_static): There is no point in
	checking changes in storage class specifier for a namespace
	declaration.
	(duplicate_decls): Tidy diagnostic message.
	* cxx-pretty-print.c (pp_cxx_left_brace): New macro.
	(pp_cxx_right_brace): Likewise.
	(pp_cxx_original_namespace_definition): New function.
	(pp_cxx_namespace_alias_definition): Likewise.
	(pp_cxx_declaration): Use them.  Handle NAMESPACE_DECLs.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.997&r2=2.998
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-pretty-print.h.diff?cvsroot=gcc&r1=1.12&r2=1.13
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-pretty-print.c.diff?cvsroot=gcc&r1=1.25&r2=1.26
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/struct1.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.3656&r2=1.3657
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cxx-pretty-print.c.diff?cvsroot=gcc&r1=1.5&r2=1.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1123&r2=1.1124
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&r1=1.234&r2=1.235


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

* [Bug c++/11762] namespace aliasing ICE in warn_extern_redeclared_static
  2003-08-01 15:45 [Bug c++/11762] New: namespace aliasing ICE in warn_extern_redeclared_static bkoz at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2003-09-07 18:53 ` cvs-commit at gcc dot gnu dot org
@ 2003-09-07 19:50 ` gdr at gcc dot gnu dot org
  2003-12-06  8:09 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: gdr at gcc dot gnu dot org @ 2003-09-07 19:50 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From gdr at gcc dot gnu dot org  2003-09-07 19:50 -------
The testcase provided in this report no longer causes a compiler crash.
However, the disease is still there.  I propose to use the following
testcase

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


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

* [Bug c++/11762] namespace aliasing ICE in warn_extern_redeclared_static
  2003-08-01 15:45 [Bug c++/11762] New: namespace aliasing ICE in warn_extern_redeclared_static bkoz at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2003-09-07 19:50 ` gdr at gcc dot gnu dot org
@ 2003-12-06  8:09 ` pinskia at gcc dot gnu dot org
  2003-12-18 18:23 ` dhazeghi at yahoo dot com
  2005-02-11 21:17 ` reichelt at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-06  8:09 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, ice-
                   |                            |checking
   Last reconfirmed|2003-08-29 11:30:59         |2003-12-06 08:09:03
               date|                            |


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


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

* [Bug c++/11762] namespace aliasing ICE in warn_extern_redeclared_static
  2003-08-01 15:45 [Bug c++/11762] New: namespace aliasing ICE in warn_extern_redeclared_static bkoz at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2003-12-06  8:09 ` pinskia at gcc dot gnu dot org
@ 2003-12-18 18:23 ` dhazeghi at yahoo dot com
  2005-02-11 21:17 ` reichelt at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-12-18 18:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dhazeghi at yahoo dot com  2003-12-18 18:05 -------
Gaby, did the test case ever get committed? This bug is still ASSIGNED, but only to 
<unassigned@gcc.gnu.org> :-(

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gdr at integrable-solutions
                   |                            |dot net


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


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

* [Bug c++/11762] namespace aliasing ICE in warn_extern_redeclared_static
  2003-08-01 15:45 [Bug c++/11762] New: namespace aliasing ICE in warn_extern_redeclared_static bkoz at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2003-12-18 18:23 ` dhazeghi at yahoo dot com
@ 2005-02-11 21:17 ` reichelt at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-02-11 21:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-02-11 17:04 -------


*** This bug has been marked as a duplicate of 16529 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |DUPLICATE
   Target Milestone|---                         |3.4.2


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


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

end of thread, other threads:[~2005-02-11 17:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-01 15:45 [Bug c++/11762] New: namespace aliasing ICE in warn_extern_redeclared_static bkoz at gcc dot gnu dot org
2003-08-01 15:53 ` [Bug c++/11762] " pinskia at physics dot uc dot edu
2003-08-01 15:57 ` gdr at integrable-solutions dot net
2003-08-23  1:04 ` dhazeghi at yahoo dot com
2003-08-29 11:31 ` gdr at gcc dot gnu dot org
2003-09-07 18:53 ` cvs-commit at gcc dot gnu dot org
2003-09-07 19:50 ` gdr at gcc dot gnu dot org
2003-12-06  8:09 ` pinskia at gcc dot gnu dot org
2003-12-18 18:23 ` dhazeghi at yahoo dot com
2005-02-11 21:17 ` 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).