aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/transparent-union.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/transparent-union.c')
-rw-r--r--test/Sema/transparent-union.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Sema/transparent-union.c b/test/Sema/transparent-union.c
index a1a67dfd26fc..dfbadcfe62c7 100644
--- a/test/Sema/transparent-union.c
+++ b/test/Sema/transparent-union.c
@@ -54,11 +54,21 @@ typedef union {
aligned_struct8 s8; // expected-warning{{alignment of field}}
} TU1 __attribute__((transparent_union));
+typedef union __attribute__((transparent_union)) {
+ aligned_struct4 s4; // expected-note{{alignment of first field}}
+ aligned_struct8 s8; // expected-warning{{alignment of field}}
+} TU1b ;
+
typedef union {
char c; // expected-note{{size of first field is 8 bits}}
int i; // expected-warning{{size of field}}
} TU2 __attribute__((transparent_union));
+typedef union __attribute__((transparent_union)){
+ char c; // expected-note{{size of first field is 8 bits}}
+ int i; // expected-warning{{size of field}}
+} TU2b;
+
typedef union {
float f; // expected-warning{{floating}}
} TU3 __attribute__((transparent_union));
@@ -98,3 +108,17 @@ union pr30520a { int b[]; } __attribute__((transparent_union)); // expected-erro
union pr30520s { struct stb b; } __attribute__((transparent_union)); // expected-error {{field has incomplete type 'struct stb'}}
union pr30520s2 { int *v; struct stb b; } __attribute__((transparent_union)); // expected-error {{field has incomplete type 'struct stb'}}
+
+typedef union __attribute__((__transparent_union__)) {
+ int *i;
+ struct st *s;
+} TU6;
+
+void bar(TU6);
+
+void foo11(int *i) {
+ bar(i);
+}
+void foo2(struct st *s) {
+ bar(s);
+}