blob: a7173b78779139d10913785f4949f4d9e923de51 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s -fno-lax-vector-conversions
Chris Lattner9697a5c2007-07-17 04:58:06 +00002
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) {
Douglas Gregord4eea832010-04-09 00:35:39 +00008 result[i] = a; // expected-error {{assigning to 'int4' from incompatible type 'float4'}}
Chris Lattner9697a5c2007-07-17 04:58:06 +00009}
10
11void test2(float4 a, int4p result, int i) {
Douglas Gregord4eea832010-04-09 00:35:39 +000012 result[i] = a; // expected-error {{assigning to 'int4' from incompatible type 'float4'}}
Chris Lattner9697a5c2007-07-17 04:58:06 +000013}
14
Chris Lattnere6327742008-04-02 05:18:44 +000015// PR2039
16typedef int a[5];
Chris Lattnerc63a1f22008-08-04 07:31:14 +000017void test3() {
Chris Lattnere6327742008-04-02 05:18:44 +000018 typedef const a b;
19 b r;
20 r[0]=10; // expected-error {{read-only variable is not assignable}}
21}
22
Chris Lattnerc63a1f22008-08-04 07:31:14 +000023int test4(const a y) {
Chris Lattnere6327742008-04-02 05:18:44 +000024 y[0] = 10; // expected-error {{read-only variable is not assignable}}
25}
26