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

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).