public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/54391] New: transparent_union typedef'ing inconsistent
@ 2012-08-28 13:14 devel at fresse dot org
  0 siblings, 0 replies; only message in thread
From: devel at fresse dot org @ 2012-08-28 13:14 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54391
           Summary: transparent_union typedef'ing inconsistent
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: devel@fresse.org


This works as expected:

union __attribute__((transparent_union)) m30_u {
    uint32_t u;
};

typedef union m30_u m30_t;

static inline double
make_double(m30_t m)
{
    return (double)m.u;
}

But typedef'ing upfront does not:

typedef union m30_u m30_t;

union __attribute__((transparent_union)) m30_u {
    uint32_t u;
};

static inline double
make_double(m30_t m)
{
    return (double)m.u;
}

...
uint32_t bar = 17;
make_double(bar);
....

transpu.c:27:2: error: incompatible type for argument 1 of 'make_double'
  printf("%.6f\n", make_double());
transpu.c:11:1: note: expected 'm30_t' but argument is of type 'uint32_t'

This is very inconsistent.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-28 13:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-28 13:14 [Bug c/54391] New: transparent_union typedef'ing inconsistent devel at fresse 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).