Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s -fno-lax-vector-conversions |
Chris Lattner | 9697a5c | 2007-07-17 04:58:06 +0000 | [diff] [blame] | 2 | |
| 3 | typedef float float4 __attribute__((vector_size(16))); |
| 4 | typedef int int4 __attribute__((vector_size(16))); |
| 5 | typedef int4* int4p; |
| 6 | |
| 7 | void test1(float4 a, int4 *result, int i) { |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 8 | result[i] = a; // expected-error {{assigning to 'int4' (vector of 4 'int' values) from incompatible type 'float4' (vector of 4 'float' values)}} |
Chris Lattner | 9697a5c | 2007-07-17 04:58:06 +0000 | [diff] [blame] | 9 | } |
| 10 | |
| 11 | void test2(float4 a, int4p result, int i) { |
Stephen Hines | 6bcf27b | 2014-05-29 04:14:42 -0700 | [diff] [blame] | 12 | result[i] = a; // expected-error {{assigning to 'int4' (vector of 4 'int' values) from incompatible type 'float4' (vector of 4 'float' values)}} |
Chris Lattner | 9697a5c | 2007-07-17 04:58:06 +0000 | [diff] [blame] | 13 | } |
| 14 | |
Chris Lattner | e632774 | 2008-04-02 05:18:44 +0000 | [diff] [blame] | 15 | // PR2039 |
| 16 | typedef int a[5]; |
Chris Lattner | c63a1f2 | 2008-08-04 07:31:14 +0000 | [diff] [blame] | 17 | void test3() { |
Chris Lattner | e632774 | 2008-04-02 05:18:44 +0000 | [diff] [blame] | 18 | typedef const a b; |
| 19 | b r; |
| 20 | r[0]=10; // expected-error {{read-only variable is not assignable}} |
| 21 | } |
| 22 | |
Chris Lattner | c63a1f2 | 2008-08-04 07:31:14 +0000 | [diff] [blame] | 23 | int test4(const a y) { |
Chris Lattner | e632774 | 2008-04-02 05:18:44 +0000 | [diff] [blame] | 24 | y[0] = 10; // expected-error {{read-only variable is not assignable}} |
| 25 | } |
| 26 | |