summaryrefslogtreecommitdiffstats
path: root/test/Sema/typedef-retain.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/typedef-retain.c')
-rw-r--r--test/Sema/typedef-retain.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/Sema/typedef-retain.c b/test/Sema/typedef-retain.c
new file mode 100644
index 0000000..ef9ec76
--- /dev/null
+++ b/test/Sema/typedef-retain.c
@@ -0,0 +1,38 @@
+// RUN: clang-cc -fsyntax-only -verify %s -fno-lax-vector-conversions
+
+typedef float float4 __attribute__((vector_size(16)));
+typedef int int4 __attribute__((vector_size(16)));
+typedef int4* int4p;
+
+void test1(float4 a, int4 *result, int i) {
+ result[i] = a; // expected-error {{assigning 'float4', expected 'int4'}}
+}
+
+void test2(float4 a, int4p result, int i) {
+ result[i] = a; // expected-error {{assigning 'float4', expected 'int4'}}
+}
+
+// PR2039
+typedef int a[5];
+void test3() {
+ typedef const a b;
+ b r;
+ r[0]=10; // expected-error {{read-only variable is not assignable}}
+}
+
+int test4(const a y) {
+ y[0] = 10; // expected-error {{read-only variable is not assignable}}
+}
+
+// PR2189
+int test5() {
+ const int s[5]; int t[5];
+ return &s == &t; // expected-warning {{comparison of distinct pointer types}}
+}
+
+int test6() {
+ const a s;
+ a t;
+ return &s == &t; // expected-warning {{comparison of distinct pointer types}}
+}
+
OpenPOWER on IntegriCloud