File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ template <typename T = void> using bit_xor = std::bit_xor<T>;
2323
2424// std:logical_and/std::logical_or with a non-void type returns bool,
2525// sycl requires returning T.
26+ #ifdef __INTEL_PREVIEW_BREAKING_CHANGES
27+ template <typename T = void > struct logical_and : std::logical_and<T> {};
28+ template <typename T = void > struct logical_or : std::logical_or<T> {};
29+
30+ #else
2631template <typename T = void > struct logical_and {
2732 T operator ()(const T &lhs, const T &rhs) const { return lhs && rhs; }
2833};
@@ -35,6 +40,8 @@ template <typename T = void> struct logical_or {
3540
3641template <> struct logical_or <void > : std::logical_or<void > {};
3742
43+ #endif
44+
3845// sycl::minimum definition should be consistent with std::min
3946template <typename T = void > struct minimum {
4047 T operator ()(const T &lhs, const T &rhs) const {
Original file line number Diff line number Diff line change 1+ // RUN: %clang -fpreview-breaking-changes -fsycl -fsyntax-only %s
2+ // RUN: %clang -fsycl -fsyntax-only %s
3+
4+ #include < cassert>
5+ #include < sycl/functional.hpp>
6+ #include < type_traits>
7+
8+ int main () {
9+ const auto logicalAnd = sycl::logical_and<int >();
10+ const auto logicalOr = sycl::logical_or<int >();
11+ const auto logicalAndVoid = sycl::logical_and<void >();
12+ const auto logicalOrVoid = sycl::logical_or<void >();
13+ #ifdef __INTEL_PREVIEW_BREAKING_CHANGES
14+ static_assert (std::is_same_v<decltype (logicalAnd (1 , 2 )), bool >);
15+ static_assert (std::is_same_v<decltype (logicalOr (1 , 2 )), bool >);
16+ static_assert (std::is_same_v<decltype (logicalAndVoid (1 , 2 )), bool >);
17+ static_assert (std::is_same_v<decltype (logicalOrVoid (1 , 2 )), bool >);
18+ #else
19+ static_assert (std::is_same_v<decltype (logicalAnd (1 , 2 )), int >);
20+ static_assert (std::is_same_v<decltype (logicalOr (1 , 2 )), int >);
21+ static_assert (std::is_same_v<decltype (logicalAndVoid (1 , 2 )), bool >);
22+ static_assert (std::is_same_v<decltype (logicalOrVoid (1 , 2 )), bool >);
23+ #endif
24+ return 0 ;
25+ }
You can’t perform that action at this time.
0 commit comments