Skip to content

Commit d6e66a7

Browse files
Add a test
1 parent 3c8d1e9 commit d6e66a7

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// RUN: %{build} -DINCLUDE_BEFORE -o %t.out
2+
// RUN: %{run} %t.out
3+
// RUN: %{build} -o %t.out
4+
// RUN: %{run} %t.out
5+
6+
// Test scenario when <complex> is included before SYCL headers.
7+
#ifdef INCLUDE_BEFORE
8+
#include <complex>
9+
#endif
10+
11+
#include <sycl/sycl.hpp>
12+
13+
#ifndef INCLUDE_BEFORE
14+
#include <complex>
15+
#endif
16+
17+
using namespace sycl;
18+
19+
int main() {
20+
queue q;
21+
auto test = []() {
22+
static_assert(sycl::detail::is_complex<std::complex<float>>::value);
23+
static_assert(sycl::detail::isComplex<std::complex<float>>::value);
24+
#ifdef __SYCL_DEVICE_ONLY__
25+
static_assert(
26+
std::is_same_v<sycl::detail::GroupOpTag<std::complex<float>>::type,
27+
sycl::detail::GroupOpC>);
28+
#endif
29+
static_assert(
30+
std::is_same_v<
31+
sycl::detail::select_cl_scalar_complex_or_T_t<std::complex<float>>,
32+
__spv::complex_float>);
33+
static_assert(
34+
std::is_same_v<sycl::detail::select_cl_scalar_complex_or_T_t<float>,
35+
float>);
36+
};
37+
test();
38+
q.single_task([=] {
39+
test();
40+
std::ignore = std::complex<float>{0.0f, 1.0f};
41+
}).wait();
42+
43+
return 0;
44+
}

0 commit comments

Comments
 (0)