| 1 |
// RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown -fdeclare-opencl-builtins -finclude-default-header -verify |
| 2 |
// RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir-unknown-unknown -fdeclare-opencl-builtins -finclude-default-header -verify |
| 3 |
// RUN: %clang_cc1 %s -cl-std=clc++2021 -cl-ext=-__opencl_c_device_enqueue,-__opencl_c_generic_address_space,-__opencl_c_pipes -triple spir-unknown-unknown -fdeclare-opencl-builtins -finclude-default-header -verify |
| 4 |
|
| 5 |
// expected-no-diagnostics |
| 6 |
|
| 7 |
template<typename T, typename U> |
| 8 |
struct is_same { |
| 9 |
static const bool value = false; |
| 10 |
}; |
| 11 |
|
| 12 |
template<typename T> |
| 13 |
struct is_same<T, T> { |
| 14 |
static const bool value = true; |
| 15 |
}; |
| 16 |
|
| 17 |
void test_is_same() { |
| 18 |
static_assert(is_same<int, int>::value); |
| 19 |
static_assert(!is_same<int, float>::value); |
| 20 |
static_assert(!is_same<__private int, int>::value); |
| 21 |
} |
| 22 |
|
| 23 |
void test_remove_address_space() { |
| 24 |
static_assert(is_same<__remove_address_space<int>::type, int>::value, |
| 25 |
"type without an address space unexpectedly modified by __remove_address_space"); |
| 26 |
#if defined(__opencl_c_generic_address_space) |
| 27 |
static_assert(is_same<__remove_address_space<__generic int>::type, int>::value, |
| 28 |
"__generic address space not removed by __remove_address_space"); |
| 29 |
#endif |
| 30 |
static_assert(is_same<__remove_address_space<__global char>::type, char>::value, |
| 31 |
"__global address space not removed by __remove_address_space"); |
| 32 |
static_assert(is_same<__remove_address_space<__private ulong>::type, ulong>::value, |
| 33 |
"__private address space not removed by __remove_address_space"); |
| 34 |
static_assert(is_same<__remove_address_space<__local short>::type, short>::value, |
| 35 |
"__local address space not removed by __remove_address_space"); |
| 36 |
static_assert(is_same<__remove_address_space<__constant int3>::type, int3>::value, |
| 37 |
"__constant address space not removed by __remove_address_space"); |
| 38 |
static_assert(is_same<__remove_address_space<const volatile __global int>::type, const volatile int>::value, |
| 39 |
"non-address-space qualifiers inappropriately removed by __remove_address_space"); |
| 40 |
} |