diff options
Diffstat (limited to 'test/SemaOpenCL')
-rw-r--r-- | test/SemaOpenCL/local.cl | 6 | ||||
-rw-r--r-- | test/SemaOpenCL/vector_conv_invalid.cl | 14 | ||||
-rw-r--r-- | test/SemaOpenCL/vector_literals_invalid.cl | 2 |
3 files changed, 21 insertions, 1 deletions
diff --git a/test/SemaOpenCL/local.cl b/test/SemaOpenCL/local.cl new file mode 100644 index 0000000000000..8637cfff30d10 --- /dev/null +++ b/test/SemaOpenCL/local.cl @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only + +__kernel void foo(void) { + __local int i; + __local int j = 2; // expected-error {{'__local' variable cannot have an initializer}} +} diff --git a/test/SemaOpenCL/vector_conv_invalid.cl b/test/SemaOpenCL/vector_conv_invalid.cl new file mode 100644 index 0000000000000..e6ef5a492f8c0 --- /dev/null +++ b/test/SemaOpenCL/vector_conv_invalid.cl @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -verify %s + +typedef unsigned int uint4 __attribute((ext_vector_type(4))); +typedef int int4 __attribute((ext_vector_type(4))); +typedef int int3 __attribute((ext_vector_type(3))); +typedef unsigned uint3 __attribute((ext_vector_type(3))); + +void vector_conv_invalid() { + uint4 u = (uint4)(1); + int4 i = u; // expected-error{{initializing 'int4' with an expression of incompatible type 'uint4'}} + int4 e = (int4)u; // expected-error{{invalid conversion between ext-vector type 'int4' and 'uint4'}} + + uint3 u4 = (uint3)u; // expected-error{{invalid conversion between ext-vector type 'uint3' and 'uint4'}} +} diff --git a/test/SemaOpenCL/vector_literals_invalid.cl b/test/SemaOpenCL/vector_literals_invalid.cl index 957680f44ffec..e4e23cd85f009 100644 --- a/test/SemaOpenCL/vector_literals_invalid.cl +++ b/test/SemaOpenCL/vector_literals_invalid.cl @@ -8,6 +8,6 @@ void vector_literals_invalid() { int4 a = (int4)(1,2,3); // expected-error{{too few elements}} int4 b = (int4)(1,2,3,4,5); // expected-error{{excess elements in vector}} - ((float4)(1.0f))++; // expected-error{{expression is not assignable}} + ((float4)(1.0f))++; // expected-error{{cannot increment value of type 'float4'}} int8 d = (int8)(a,(float4)(1)); // expected-error{{initializing 'int' with an expression of incompatible type 'float4'}} } |