This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/54391] New: transparent_union typedef'ing inconsistent
- From: "devel at fresse dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 28 Aug 2012 13:13:57 +0000
- Subject: [Bug c/54391] New: transparent_union typedef'ing inconsistent
- Auto-submitted: auto-generated
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.