aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/typedef-retain.c
blob: d216466360b7c7c999a8337ade6d86a887008263 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// RUN: %clang_cc1 -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 to 'int4' (vector of 4 'int' values) from incompatible type 'float4' (vector of 4 'float' values)}}
}

void test2(float4 a, int4p result, int i) {
    result[i] = a; // expected-error {{assigning to 'int4' (vector of 4 'int' values) from incompatible type 'float4' (vector of 4 'float' values)}}
}

// 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}}
}