File tree Expand file tree Collapse file tree 3 files changed +25
-35
lines changed Expand file tree Collapse file tree 3 files changed +25
-35
lines changed Original file line number Diff line number Diff line change @@ -23,33 +23,23 @@ 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- template <typename T = void >
27- struct logical_and
2826#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
29- : std::logical_and<T>
30- {
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+
3130#else
32- {
31+ template < typename T = void > struct logical_and {
3332 T operator ()(const T &lhs, const T &rhs) const { return lhs && rhs; }
34- #endif
35- }; // namespace _V1
33+ };
3634
37- #ifndef __INTEL_PREVIEW_BREAKING_CHANGES
3835template <> struct logical_and <void > : std::logical_and<void > {};
39- #endif
4036
41- template <typename T = void >
42- struct logical_or
43- #ifdef __INTEL_PREVIEW_BREAKING_CHANGES
44- : std::logical_or<T>
45- {
46- #else
47- {
37+ template <typename T = void > struct logical_or {
4838 T operator ()(const T &lhs, const T &rhs) const { return lhs || rhs; }
49- #endif
50- }; // namespace sycl
51- #ifndef __INTEL_PREVIEW_BREAKING_CHANGES
39+ };
40+
5241template <> struct logical_or <void > : std::logical_or<void > {};
42+
5343#endif
5444
5545// sycl::minimum definition should be consistent with std::min
Original file line number Diff line number Diff line change 11// RUN: %clang -fpreview-breaking-changes -fsycl -o - %s
2- // RUN: not %clang -fpreview-breaking-changes -fsycl -DTEST_VOID_TYPES -o - %s
32// RUN: %clang -fsycl -o - %s
4- // RUN: not %clang -fsycl -fsyntax-only -DTEST_VOID_TYPES -o - %s
53
64#include < cassert>
75#include < sycl/functional.hpp>
@@ -16,20 +14,6 @@ int main() {
1614#else
1715 static_assert (std::is_same_v<decltype (logicalAnd (1 , 2 )), int > == true );
1816 static_assert (std::is_same_v<decltype (logicalOr (1 , 2 )), int > == true );
19- #endif
20- const auto logicalAndVoid = sycl::logical_and<void >();
21- const auto logicalOrVoid = sycl::logical_or<void >();
22-
23- static_assert (std::is_same_v<decltype (logicalAndVoid (1 , 2 )), bool > == true );
24- static_assert (std::is_same_v<decltype (logicalOrVoid (1 , 2 )), bool > == true );
25-
26- #ifdef TEST_VOID_TYPES
27- static_assert (std::is_same_v<decltype (logicalAndVoid (static_cast <void >(1 ),
28- static_cast <void >(2 ))),
29- bool > == true );
30- static_assert (std::is_same_v<decltype (logicalOrVoid (static_cast <void >(1 ),
31- static_cast <void >(2 ))),
32- bool > == true );
3317#endif
3418 return 0 ;
3519}
Original file line number Diff line number Diff line change 1+
2+ // RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s
3+ // RUN: %clangxx -fsycl -fpreview-breaking-changes -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s
4+
5+ #include < cassert>
6+ #include < sycl/functional.hpp>
7+ #include < type_traits>
8+
9+
10+ const auto logicalAndVoid = sycl::logical_and<void >();
11+ const auto logicalOrVoid = sycl::logical_or<void >();
12+
13+ // expected-error@+1 {{}}
14+ static_assert (std::is_same_v<decltype (logicalAndVoid(static_cast <void >(1 ), static_cast <void >(2 ))), bool > == true );
15+ // expected-error@+1 {{}}
16+ static_assert (std::is_same_v<decltype (logicalOrVoid(static_cast <void >(1 ), static_cast <void >(2 ))), bool > == true );
You can’t perform that action at this time.
0 commit comments