public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14160] New: Mangled names for anonymous namespace members not guaranteeed unique
@ 2004-02-16 15:29 gcc-bugs at metafoo dot co dot uk
  2004-02-16 15:43 ` [Bug c++/14160] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: gcc-bugs at metafoo dot co dot uk @ 2004-02-16 15:29 UTC (permalink / raw)
  To: gcc-bugs

I have two source files: 
 
main.cpp: 
int main(){return 0;} 
 
test.cpp: 
namespace { void function() {} } 
 
I run the following commands: 
$ g++ -c -o main.o main.cpp 
$ g++ -c -o test1.o test.cpp 
$ g++ -c -o test2.o test.cpp 
$ g++ main.o test1.o test2.o 
test2.o(.text+0x0): In function `(anonymous namespace)::function()': 
: multiple definition of `(anonymous namespace)::function()' 
test1.o(.text+0x0): first defined here 
collect2: ld returned 1 exit status 
 
The anonymous namespaces used in creating test1.o and test2.o are guaranteed 
by the C++ standard to be distinct and unique. So this program should link. 
 
I can see three solutions: shove a GUID into the anon namespace name, teach 
the linker to ignore anon namespace names, or don't emit the names at all 
(which decreases link times - and g++ is still a conforming implementation by 
the as-if rule). 
 
Richard

-- 
           Summary: Mangled names for anonymous namespace members not
                    guaranteeed unique
           Product: gcc
           Version: 3.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc-bugs at metafoo dot co dot uk
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/14160] Mangled names for anonymous namespace members not guaranteeed unique
  2004-02-16 15:29 [Bug c++/14160] New: Mangled names for anonymous namespace members not guaranteeed unique gcc-bugs at metafoo dot co dot uk
@ 2004-02-16 15:43 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-16 15:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-16 15:43 -------
This is a dup of bug 9393.  Which is fixed for 3.3.1.  3.2.x is no longer being updated.

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

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE
   Target Milestone|---                         |3.3


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


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

end of thread, other threads:[~2004-02-16 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-16 15:29 [Bug c++/14160] New: Mangled names for anonymous namespace members not guaranteeed unique gcc-bugs at metafoo dot co dot uk
2004-02-16 15:43 ` [Bug c++/14160] " pinskia 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).