https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65808
Bug ID: 65808 Summary: -pedantic -std=gnu11 results in warning for transparent_union usage Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: equinox-gccbugs at diac24 dot net Created attachment 35359 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35359&action=edit test program, compile with -std=gnu11 -pedantic Trying to use a transparent_union results in a warning when -pedantic is used, even though -std=gnu11 is specified. Test program is this: (gcc -std=gnu11 -pedantic -c /tmp/uniontest.c) struct a { int a; }; struct b { int b; }; __extension__ union ab { struct a *pa; struct b *pb; } __attribute__ ((transparent_union)); extern void func1 (union ab arg); __extension__ extern void func2 (union ab arg); void test(void) { struct a sa = { 1 }; func1(&sa); /* warning */ __extension__ func1(&sa); /* no warning */ func2(&sa); /* warning */ } Expected behaviour: no warning at all, or some way to put __extension__ on the union or the function prototype. Actual behaviour: __extension__ must be used on each and every individual function call, or a warning occurs: /tmp/uniontest.c: In function ‘test’: /tmp/uniontest.c:15:2: warning: ISO C prohibits argument conversion to union type [-Wpedantic] func1(&sa); /* warning */ ^ /tmp/uniontest.c:17:2: warning: ISO C prohibits argument conversion to union type [-Wpedantic] func2(&sa); /* warning */ ^