public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/47376] New: Duplicate member through anonymous unions not reported
@ 2011-01-20 13:17 jengelh at medozas dot de
  2011-02-07  2:00 ` [Bug c/47376] " jsm28 at gcc dot gnu.org
  2011-02-07  2:00 ` jsm28 at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: jengelh at medozas dot de @ 2011-01-20 13:17 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Duplicate member through anonymous unions not reported
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jengelh@medozas.de
              Host: x86_64-suse-linux
            Target: x86_64-suse-linux
             Build: x86_64-suse-linux


Given the following example:
---
struct foo {
        int a;
        union {
                int a;
                double b;
        };
};

int main(void)
{
        struct foo f;
        f.a = 123;
        return 0;
}
---

How it came to be:
Accidental error where I had forgotten to remove foo.a after having added
foo.{anonymous}.a.

What has been observed:
It compiles fine, which caused this programming error of mine to go unnoticed
for half a day. It seems gcc gives foo.a precedence over foo.{anonymous}.a when
accessing it through f.a=....

What had been expected:
I would have liked that gcc emit at least a warning because f.a is ambiguous.


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

* [Bug c/47376] Duplicate member through anonymous unions not reported
  2011-01-20 13:17 [Bug c/47376] New: Duplicate member through anonymous unions not reported jengelh at medozas dot de
  2011-02-07  2:00 ` [Bug c/47376] " jsm28 at gcc dot gnu.org
@ 2011-02-07  2:00 ` jsm28 at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2011-02-07  2:00 UTC (permalink / raw)
  To: gcc-bugs

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

Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.0

--- Comment #1 from Joseph S. Myers <jsm28 at gcc dot gnu.org> 2011-02-07 01:59:50 UTC ---
Fixed in 4.6.


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

* [Bug c/47376] Duplicate member through anonymous unions not reported
  2011-01-20 13:17 [Bug c/47376] New: Duplicate member through anonymous unions not reported jengelh at medozas dot de
@ 2011-02-07  2:00 ` jsm28 at gcc dot gnu.org
  2011-02-07  2:00 ` jsm28 at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2011-02-07  2:00 UTC (permalink / raw)
  To: gcc-bugs

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

Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #2 from Joseph S. Myers <jsm28 at gcc dot gnu.org> 2011-02-07 02:00:15 UTC ---
Fixed in 4.6.

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


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

end of thread, other threads:[~2011-02-07  2:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-20 13:17 [Bug c/47376] New: Duplicate member through anonymous unions not reported jengelh at medozas dot de
2011-02-07  2:00 ` [Bug c/47376] " jsm28 at gcc dot gnu.org
2011-02-07  2:00 ` jsm28 at gcc dot gnu.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).