Tobias Grosser | 766bcc2 | 2011-09-22 13:03:14 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify %s |
| 2 | |
| 3 | typedef unsigned int uint4 __attribute((ext_vector_type(4))); |
| 4 | typedef int int4 __attribute((ext_vector_type(4))); |
| 5 | typedef int int3 __attribute((ext_vector_type(3))); |
| 6 | typedef unsigned uint3 __attribute((ext_vector_type(3))); |
| 7 | |
Yaxun Liu | 085a23f | 2017-10-03 14:34:29 +0000 | [diff] [blame] | 8 | void vector_conv_invalid(const global int4 *const_global_ptr) { |
Tobias Grosser | 766bcc2 | 2011-09-22 13:03:14 +0000 | [diff] [blame] | 9 | uint4 u = (uint4)(1); |
Anastasia Stulova | 869d17d | 2019-12-27 13:38:48 +0000 | [diff] [blame] | 10 | int4 i = u; // expected-error{{initializing '__private int4' (vector of 4 'int' values) with an expression of incompatible type '__private uint4' (vector of 4 'unsigned int' values)}} |
Benjamin Kramer | 1adc8c3 | 2014-04-25 20:41:38 +0000 | [diff] [blame] | 11 | 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)}} |
Tobias Grosser | 766bcc2 | 2011-09-22 13:03:14 +0000 | [diff] [blame] | 12 | |
Benjamin Kramer | 1adc8c3 | 2014-04-25 20:41:38 +0000 | [diff] [blame] | 13 | 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)}} |
Yaxun Liu | 085a23f | 2017-10-03 14:34:29 +0000 | [diff] [blame] | 14 | |
| 15 | e = (const int4)i; |
| 16 | e = (constant int4)i; |
| 17 | e = (private int4)i; |
| 18 | |
Anastasia Stulova | 869d17d | 2019-12-27 13:38:48 +0000 | [diff] [blame] | 19 | private int4 *private_ptr = (const private int4 *)const_global_ptr; // expected-error{{casting 'const __global int4 *' to type 'const __private int4 *' changes address space of pointer}} |
| 20 | global int4 *global_ptr = const_global_ptr; // expected-warning {{initializing '__global int4 *__private' with an expression of type 'const __global int4 *__private' discards qualifiers}} |
Yaxun Liu | 085a23f | 2017-10-03 14:34:29 +0000 | [diff] [blame] | 21 | global_ptr = (global int4 *)const_global_ptr; |
Tobias Grosser | 766bcc2 | 2011-09-22 13:03:14 +0000 | [diff] [blame] | 22 | } |