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
* [Bug c++/28438] Anon namespace pointers in exported classes
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 ` pinskia at gcc dot gnu dot org
2006-07-19 20:02 ` jason at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-19 15:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-07-19 15:45 -------
B violates ODR rules as the class for A is different between the TUs as it is
in an anon namespace.
See PR 28360 for full details.
*** This bug has been marked as a duplicate of 28360 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28438
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/28438] Anon namespace pointers in exported classes
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
1 sibling, 0 replies; 3+ messages in thread
From: jason at redhat dot com @ 2006-07-19 20:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jason at redhat dot com 2006-07-19 20:02 -------
Subject: Re: New: Anon namespace pointers in exported classes
Yes, this is an ODR violation. However, the patch I'm working on will
allow it to compile (as a side effect of other desired changes).
Jason
--
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).