1 // RUN: clang -fsyntax-only -Xclang -verify %s
5 } TU
__attribute__((transparent_union
));
9 void g(int *ip
, float *fp
, char *cp
) {
12 f(cp
); // expected-error{{incompatible type}}
15 TU tu_ip
= ip
; // expected-error{{incompatible type}}
20 /* FIXME: we'd like to just use an "int" here and align it differently
21 from the normal "int", but if we do so we lose the alignment
22 information from the typedef within the compiler. */
23 typedef struct { int x
, y
; } __attribute__((aligned(8))) aligned_struct8
;
25 typedef struct { int x
, y
; } __attribute__((aligned(4))) aligned_struct4
;
27 aligned_struct4 s4
; // expected-note{{alignment of first field}}
28 aligned_struct8 s8
; // expected-warning{{alignment of field}}
29 } TU1
__attribute__((transparent_union
));
32 char c
; // expected-note{{size of first field is 8 bits}}
33 int i
; // expected-warning{{size of field}}
34 } TU2
__attribute__((transparent_union
));
37 float f
; // expected-warning{{floating}}
38 } TU3
__attribute__((transparent_union
));
40 typedef union { } TU4
__attribute__((transparent_union
)); // expected-warning{{field}}