typedef-retain.c revision ad53eff73224b29955da59f65e6b9eba1a5f6b76
1// RUN: clang -fsyntax-only -verify %s -fno-lax-vector-conversions
2
3typedef float float4 __attribute__((vector_size(16)));
4typedef int int4 __attribute__((vector_size(16)));
5typedef int4* int4p;
6
7void test1(float4 a, int4 *result, int i) {
8    result[i] = a; // expected-error {{assigning 'float4', expected 'int4'}}
9}
10
11void test2(float4 a, int4p result, int i) {
12    result[i] = a; // expected-error {{assigning 'float4', expected 'int4'}}
13}
14
15// PR2039
16typedef int a[5];
17void test3() {
18  typedef const a b;
19  b r;
20  r[0]=10;  // expected-error {{read-only variable is not assignable}}
21}
22
23int test4(const a y) {
24  y[0] = 10; // expected-error {{read-only variable is not assignable}}
25}
26
27// PR2189
28int test5() {
29  const int s[5]; int t[5];
30  return &s == &t;   // expected-warning {{comparison of distinct pointer types}}
31}
32
33int test6() {
34  const a s;
35  a t;
36  return &s == &t;   // expected-warning {{comparison of distinct pointer types}}
37}
38
39