summaryrefslogtreecommitdiff
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.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Sema/transparent-union.c b/test/Sema/transparent-union.c
index 0481127674804..7967535db8c13 100644
--- a/test/Sema/transparent-union.c
+++ b/test/Sema/transparent-union.c
@@ -43,6 +43,35 @@ void fi(int i) {} // expected-error{{conflicting types}}
void fvpp(TU); // expected-note{{previous declaration is here}}
void fvpp(void **v) {} // expected-error{{conflicting types}}
+/* Test redeclaring a function taking a transparent_union arg more than twice.
+ Merging different declarations depends on their order, vary order too. */
+
+void f_triple0(TU tu) {}
+void f_triple0(int *); // expected-note{{previous declaration is here}}
+void f_triple0(float *f); // expected-error{{conflicting types}}
+
+void f_triple1(int *);
+void f_triple1(TU tu) {} // expected-note{{previous definition is here}}
+void f_triple1(float *f); // expected-error{{conflicting types}}
+
+void f_triple2(int *); // expected-note{{previous declaration is here}}
+void f_triple2(float *f); // expected-error{{conflicting types}}
+void f_triple2(TU tu) {}
+
+/* Test calling redeclared function taking a transparent_union arg. */
+
+void f_callee(TU);
+void f_callee(int *i) {} // expected-note{{passing argument to parameter 'i' here}}
+
+void caller(void) {
+ TU tu;
+ f_callee(tu); // expected-error{{passing 'TU' to parameter of incompatible type 'int *'}}
+
+ int *i;
+ f_callee(i);
+}
+
+
/* FIXME: we'd like to just use an "int" here and align it differently
from the normal "int", but if we do so we lose the alignment
information from the typedef within the compiler. */