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: unassig...@gcc.gnu.org
        ReportedBy: de...@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.

Reply via email to