summaryrefslogtreecommitdiff
path: root/test/Sema/transparent-union.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-02-20 13:06:31 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-02-20 13:06:31 +0000
commitbca07a4524feb4edec581062d631a13116320a24 (patch)
treea9243275843fbeaa590afc07ee888e006b8d54ea /test/Sema/transparent-union.c
parent998bc5802ecdd65ce3b270f6c69a8ae8557f0a10 (diff)
downloadsrc-test2-bca07a4524feb4edec581062d631a13116320a24.tar.gz
src-test2-bca07a4524feb4edec581062d631a13116320a24.zip
Notes
Diffstat (limited to 'test/Sema/transparent-union.c')
-rw-r--r--test/Sema/transparent-union.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/Sema/transparent-union.c b/test/Sema/transparent-union.c
index 27d5c2403b43..ab1ba1867f47 100644
--- a/test/Sema/transparent-union.c
+++ b/test/Sema/transparent-union.c
@@ -2,6 +2,8 @@
typedef union {
int *ip;
float *fp;
+ long *__restrict rlp;
+ void *vpa[1];
} TU __attribute__((transparent_union));
void f(TU); // expected-note{{passing argument to parameter here}}
@@ -17,6 +19,30 @@ void g(int *ip, float *fp, char *cp) {
tu.ip = ip;
}
+/* Test ability to redeclare a function taking a transparent_union arg
+ with various compatible and incompatible argument types. */
+
+void fip(TU);
+void fip(int *i) {}
+
+void ffp(TU);
+void ffp(float *f) {}
+
+void flp(TU);
+void flp(long *l) {}
+
+void fvp(TU); // expected-note{{previous declaration is here}}
+void fvp(void *p) {} // expected-error{{conflicting types}}
+
+void fsp(TU); // expected-note{{previous declaration is here}}
+void fsp(short *s) {} // expected-error{{conflicting types}}
+
+void fi(TU); // expected-note{{previous declaration is here}}
+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}}
+
/* 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. */