| 1 |
// RUN: %clang_cc1 -fdeclare-opencl-builtins -finclude-default-header %s -cl-std=clc++ -verify |
| 2 |
|
| 3 |
// Test as_type, which is defined in terms of __builtin_astype. |
| 4 |
template <typename T> |
| 5 |
auto templated_astype(T x) { |
| 6 |
return as_int2(x); |
| 7 |
// expected-error@-1{{invalid reinterpretation: sizes of 'int2' (vector of 2 'int' values) and '__private int' must match}} |
| 8 |
} |
| 9 |
|
| 10 |
auto test_long(long x) { return templated_astype(x); } |
| 11 |
|
| 12 |
auto neg_test_int(int x) { return templated_astype(x); } |
| 13 |
// expected-note@-1{{in instantiation of function template specialization 'templated_astype<int>' requested here}} |
| 14 |
|
| 15 |
auto test_short4(short4 x) { return templated_astype(x); } |
| 16 |
|
| 17 |
// Test __builtin_astype. |
| 18 |
template <typename T> |
| 19 |
auto templated_builtin_astype(T x) { |
| 20 |
return __builtin_astype(x, int2); |
| 21 |
} |
| 22 |
|
| 23 |
auto test_builtin(char8 x) { return templated_builtin_astype(x); } |