public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28438]  New: Anon namespace pointers in exported classes
@ 2006-07-19 15:39 jakub at gcc dot gnu dot org
  2006-07-19 15:45 ` [Bug c++/28438] " pinskia at gcc dot gnu dot org
  2006-07-19 20:02 ` jason at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-07-19 15:39 UTC (permalink / raw)
  To: gcc-bugs

Both KDE and OOo fail to build with the anon namespace not exported changes.
A short testcase of what they are doing:
cat > test.h <<EOF
namespace { struct A {}; }
struct B
{
  A *a;
  B ();
};
EOF
cat > test1.C <<EOF
#include "test.h"

B::B () : a(0)
{
}

B b;

int
main (void)
{
}
EOF
cat > test2.C <<EOF
#include "test.h"

B c;
EOF
g++ -c test1.C
g++ -c test2.C
g++ -o test test1.o test2.o
This doesn't link with GCC head, because B::B() constructor is a local symbol
in test1.s.

My understanding is that this is a [basic.def.odr]/5 violation, as
lthough each definition consists of the same sequence of tokens,
corresponding names (in this case A) don't refer to the same entity
(as A's definition in anonymous namespace means it is a different thing
in each translation unit), but I'd like some confirmation about this.


-- 
           Summary: Anon namespace pointers in exported classes
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


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

end of thread, other threads:[~2006-07-19 20:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-19 15:39 [Bug c++/28438] New: Anon namespace pointers in exported classes jakub at gcc dot gnu dot org
2006-07-19 15:45 ` [Bug c++/28438] " pinskia at gcc dot gnu dot org
2006-07-19 20:02 ` jason at redhat dot com

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