public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/13140] declaration in global namespace, definition inside named or anon namespace
Date: Tue, 23 Mar 2004 20:15:00 -0000	[thread overview]
Message-ID: <20040323201509.22244.qmail@sources.redhat.com> (raw)
In-Reply-To: <20031120194900.13140.phil.el@wanadoo.fr>


------- Additional Comments From bangerth at dealii dot org  2004-03-23 20:15 -------
I actually tripped over this in my own program just now. To explain why 
this is a particularly evil bug: in a header file x.h I had 
  struct X { void f(); }; 
and in y.h: 
  namespace NS { 
    struct X { void f(); }; 
  } 
 
Then in x.cc, I would 
  #include "x.h" 
  void X::f() {}; 
but in y.cc I made the error to include x.h instead of y.h: 
  #include "x.h" 
  namespace NS { 
    void X::f() {}; 
  } 
 
This compiled without error, as explained in this PR, but I later got 
linker errors about multiply defined symbols X::f, despite the fact that 
I defined these symbols in the second .cc file in a namespace. It is thus 
not only accepts-invalid, but also wrong-code. Needless to say that it was 
rather tedious to find the problem... 
 
I take the liberty to set the milestone tentatively to 3.5, in the hope 
that someone comes along with a fix to this problem until then. 
 
W. 
   

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
      Known to fail|                            |2.95.3 3.2.3 3.3.3 3.4.0
                   |                            |3.5.0
   Target Milestone|---                         |3.5.0


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


  parent reply	other threads:[~2004-03-23 20:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-20 19:49 [Bug c++/13140] New: " phil dot el at wanadoo dot fr
2003-11-20 20:44 ` [Bug c++/13140] " bangerth at dealii dot org
2004-02-03  8:16 ` pinskia at gcc dot gnu dot org
2004-03-23 20:15 ` bangerth at dealii dot org [this message]
2004-05-26 12:31 ` pinskia at gcc dot gnu dot org
2004-10-03 14:57 ` pinskia at gcc dot gnu dot org
2005-04-01 13:08 ` pinskia at gcc dot gnu dot org
2005-09-15 16:04 ` cvs-commit at gcc dot gnu dot org
2005-09-16 18:16 ` reichelt at gcc dot gnu dot org
     [not found] <bug-13140-3534@http.gcc.gnu.org/bugzilla/>
2006-01-11 14:16 ` pinskia at gcc dot gnu dot org
2006-02-21 21:11 ` pinskia at gcc dot gnu dot org
2006-06-21 23:11 ` pinskia at gcc dot gnu dot org
2006-06-21 23:15 ` zvonsully at gmail dot com
2006-06-21 23:40 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040323201509.22244.qmail@sources.redhat.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).