diff --git a/clang/test/SemaOpenCL/invalid-vector-literals.cl b/clang/test/SemaOpenCL/invalid-vector-literals.cl index 4e502aad3bad..1d82fedf29de 100644 --- a/clang/test/SemaOpenCL/invalid-vector-literals.cl +++ b/clang/test/SemaOpenCL/invalid-vector-literals.cl @@ -8,7 +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{{cannot increment value of type 'float4'}} int8 d = (int8)(a,(float4)(1)); // expected-error{{initializing 'int' with an expression of incompatible type 'float4'}} ((int4)(0)).x = 8; // expected-error{{expression is not assignable}} } diff --git a/clang/test/SemaOpenCL/logical-ops.cl b/clang/test/SemaOpenCL/operators.cl similarity index 90% rename from clang/test/SemaOpenCL/logical-ops.cl rename to clang/test/SemaOpenCL/operators.cl index f6972c46e2ad..cf359acd5acb 100644 --- a/clang/test/SemaOpenCL/logical-ops.cl +++ b/clang/test/SemaOpenCL/operators.cl @@ -36,6 +36,8 @@ kernel void float_ops() { #if __OPENCL_C_VERSION__ < 120 // expected-error@-2{{invalid argument type}} #endif + float fcst = 5.5f; + float fremainder = fcst % 2.0f; // expected-error {{invalid operands to binary expression}} } kernel void vec_float_ops() { @@ -56,6 +58,8 @@ kernel void vec_float_ops() { #if __OPENCL_C_VERSION__ < 120 // expected-error@-2{{invalid argument type}} #endif + float4 f4cst = (float4)(5.5f, 5.5f, 5.5f, 5.5f); + float4 f4remainder = f4cst % (float4)(2.0f, 2.0f, 2.0f, 2.0f); // expected-error {{invalid operands to binary expression}} } kernel void double_ops() { @@ -85,6 +89,8 @@ kernel void double_ops() { #if __OPENCL_C_VERSION__ < 120 // expected-error@-2{{invalid argument type}} #endif + double dcst = 5.5; + double dremainder = dcst % 2.0; // expected-error {{invalid operands to binary expression}} } kernel void vec_double_ops() { diff --git a/clang/test/SemaOpenCL/vector_inc_dec_ops.cl b/clang/test/SemaOpenCL/vector_inc_dec_ops.cl index c65bbcb5b749..533253ee696f 100644 --- a/clang/test/SemaOpenCL/vector_inc_dec_ops.cl +++ b/clang/test/SemaOpenCL/vector_inc_dec_ops.cl @@ -1,9 +1,9 @@ // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -// expected-no-diagnostics typedef __attribute__((ext_vector_type(2))) char char2; typedef __attribute__((ext_vector_type(4))) unsigned int uint4; typedef __attribute__((ext_vector_type(8))) long long8; +typedef __attribute__((ext_vector_type(4))) float float4; void vectorIncrementDecrementOps() { @@ -17,3 +17,10 @@ void vectorIncrementDecrementOps() ++B; C++; } + +void invalidIncrementDecrementOps() { + ((float4)(1.0f))++; // expected-error{{cannot increment value of type 'float4'}} + float4 i; + ++i; // expected-error{{cannot increment value of type '__private float4'}} + i--; // expected-error{{cannot decrement value of type '__private float4'}} +}