diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
| commit | 461a67fa15370a9ec88f8f8a240bf7c123bb2029 (patch) | |
| tree | 6942083d7d56bba40ec790a453ca58ad3baf6832 /test/SemaOpenCL/vector_conv_invalid.cl | |
| parent | 75c3240472ba6ac2669ee72ca67eb72d4e2851fc (diff) | |
Notes
Diffstat (limited to 'test/SemaOpenCL/vector_conv_invalid.cl')
| -rw-r--r-- | test/SemaOpenCL/vector_conv_invalid.cl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/SemaOpenCL/vector_conv_invalid.cl b/test/SemaOpenCL/vector_conv_invalid.cl index 90cec26a605a..e32d84fd6a7e 100644 --- a/test/SemaOpenCL/vector_conv_invalid.cl +++ b/test/SemaOpenCL/vector_conv_invalid.cl @@ -5,10 +5,18 @@ 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() { +void vector_conv_invalid(const global int4 *const_global_ptr) { uint4 u = (uint4)(1); int4 i = u; // expected-error{{initializing 'int4' (vector of 4 'int' values) with an expression of incompatible type 'uint4' (vector of 4 'unsigned int' values)}} int4 e = (int4)u; // expected-error{{invalid conversion between ext-vector type 'int4' (vector of 4 'int' values) and 'uint4' (vector of 4 'unsigned int' values)}} uint3 u4 = (uint3)u; // expected-error{{invalid conversion between ext-vector type 'uint3' (vector of 3 'unsigned int' values) and 'uint4' (vector of 4 'unsigned int' values)}} + + e = (const int4)i; + e = (constant int4)i; + e = (private int4)i; + + private int4 *private_ptr = (const private int4 *)const_global_ptr; // expected-error{{casting 'const __global int4 *' to type 'const int4 *' changes address space of pointer}} + global int4 *global_ptr = const_global_ptr; // expected-warning {{initializing '__global int4 *' with an expression of type 'const __global int4 *' discards qualifiers}} + global_ptr = (global int4 *)const_global_ptr; } |
