public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12620] New: compatibility issue with anonymous struct/union support
@ 2003-10-15 12:03 jbeulich at novell dot com
2003-10-15 12:23 ` [Bug c++/12620] " jbeulich at novell dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: jbeulich at novell dot com @ 2003-10-15 12:03 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=12620
Summary: compatibility issue with anonymous struct/union support
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jbeulich at novell dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
In
class ccc {
public:
union {
int i;
};
};
all other compilers I can check with (Intel, Microsoft, Borland, MetroWerks)
treat i as a member of ccc. Since the feature is documented to exist for
compatibility reasons, the behavior should be compatible, too.
This can easily be tested with above declaration and the code
template<typename T> void test(T p);
void test() {
test(&ccc::i);
}
by observing what template instantiation is selected by the compiler.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/12620] compatibility issue with anonymous struct/union support
2003-10-15 12:03 [Bug c++/12620] New: compatibility issue with anonymous struct/union support jbeulich at novell dot com
@ 2003-10-15 12:23 ` jbeulich at novell dot com
2003-10-15 12:25 ` jbeulich at novell dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jbeulich at novell dot com @ 2003-10-15 12:23 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=12620
------- Additional Comments From jbeulich at novell dot com 2003-10-15 12:23 -------
gcc 2.96, btw., also behaves the requested/expected way.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/12620] compatibility issue with anonymous struct/union support
2003-10-15 12:03 [Bug c++/12620] New: compatibility issue with anonymous struct/union support jbeulich at novell dot com
2003-10-15 12:23 ` [Bug c++/12620] " jbeulich at novell dot com
@ 2003-10-15 12:25 ` jbeulich at novell dot com
2003-10-15 17:52 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jbeulich at novell dot com @ 2003-10-15 12:25 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=12620
------- Additional Comments From jbeulich at novell dot com 2003-10-15 12:25 -------
... to some degree: for the example given, &ccc::i evaluates to the offset based
from the starting address of ccc, not (as 3.3.1 does) from the start of the
union. For naming purposes, the anonymous union is still considered.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/12620] compatibility issue with anonymous struct/union support
2003-10-15 12:03 [Bug c++/12620] New: compatibility issue with anonymous struct/union support jbeulich at novell dot com
2003-10-15 12:23 ` [Bug c++/12620] " jbeulich at novell dot com
2003-10-15 12:25 ` jbeulich at novell dot com
@ 2003-10-15 17:52 ` pinskia at gcc dot gnu dot org
2003-10-16 7:46 ` jbeulich at novell dot com
2003-11-28 21:39 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-15 17:52 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=12620
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-10-15 17:52 -------
Can you give a full example of what is wrong?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/12620] compatibility issue with anonymous struct/union support
2003-10-15 12:03 [Bug c++/12620] New: compatibility issue with anonymous struct/union support jbeulich at novell dot com
` (2 preceding siblings ...)
2003-10-15 17:52 ` pinskia at gcc dot gnu dot org
@ 2003-10-16 7:46 ` jbeulich at novell dot com
2003-11-28 21:39 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: jbeulich at novell dot com @ 2003-10-16 7:46 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=12620
------- Additional Comments From jbeulich at novell dot com 2003-10-16 07:46 -------
What is wrong is that
a) the template gets instantiated with T = int ccc::{anonymous}::* rather than T
= int ccc::* and
b) &ccc::i is calculated relative to the union base address rather than the
classes one, so if there are class members preceding the union (or base
classes), then this still continues to be zero (note that I understand that the
actual value of the member pointer should not be used, but in a debugging
context it may be of actual use).
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/12620] compatibility issue with anonymous struct/union support
2003-10-15 12:03 [Bug c++/12620] New: compatibility issue with anonymous struct/union support jbeulich at novell dot com
` (3 preceding siblings ...)
2003-10-16 7:46 ` jbeulich at novell dot com
@ 2003-11-28 21:39 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-28 21:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-11-28 21:39 -------
This is done this way because it is the right thing to do as members of the anonymous union are
not really members of the ccc but they only act as members just for name lookup reasons.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12620
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-11-28 21:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-15 12:03 [Bug c++/12620] New: compatibility issue with anonymous struct/union support jbeulich at novell dot com
2003-10-15 12:23 ` [Bug c++/12620] " jbeulich at novell dot com
2003-10-15 12:25 ` jbeulich at novell dot com
2003-10-15 17:52 ` pinskia at gcc dot gnu dot org
2003-10-16 7:46 ` jbeulich at novell dot com
2003-11-28 21:39 ` 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).