Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions sycl/include/sycl/functional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,9 @@ template <typename T = void> using multiplies = std::multiplies<T>;
template <typename T = void> using bit_and = std::bit_and<T>;
template <typename T = void> using bit_or = std::bit_or<T>;
template <typename T = void> using bit_xor = std::bit_xor<T>;

// std:logical_and/std::logical_or with a non-void type returns bool,
// sycl requires returning T.
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
template <typename T = void> struct logical_and : std::logical_and<T> {};
template <typename T = void> struct logical_or : std::logical_or<T> {};

#else
template <typename T = void> struct logical_and {
T operator()(const T &lhs, const T &rhs) const { return lhs && rhs; }
};

template <> struct logical_and<void> : std::logical_and<void> {};

template <typename T = void> struct logical_or {
T operator()(const T &lhs, const T &rhs) const { return lhs || rhs; }
};

template <> struct logical_or<void> : std::logical_or<void> {};

#endif

// sycl::minimum definition should be consistent with std::min
template <typename T = void> struct minimum {
T operator()(const T &lhs, const T &rhs) const {
Expand Down
8 changes: 0 additions & 8 deletions sycl/test/basic_tests/logical_operations.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// RUN: %clang -fpreview-breaking-changes -fsycl -fsyntax-only %s
// RUN: %clang -fsycl -fsyntax-only %s

#include <cassert>
Expand All @@ -10,16 +9,9 @@ int main() {
const auto logicalOr = sycl::logical_or<int>();
const auto logicalAndVoid = sycl::logical_and<void>();
const auto logicalOrVoid = sycl::logical_or<void>();
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
static_assert(std::is_same_v<decltype(logicalAnd(1, 2)), bool>);
static_assert(std::is_same_v<decltype(logicalOr(1, 2)), bool>);
static_assert(std::is_same_v<decltype(logicalAndVoid(1, 2)), bool>);
static_assert(std::is_same_v<decltype(logicalOrVoid(1, 2)), bool>);
#else
static_assert(std::is_same_v<decltype(logicalAnd(1, 2)), int>);
static_assert(std::is_same_v<decltype(logicalOr(1, 2)), int>);
static_assert(std::is_same_v<decltype(logicalAndVoid(1, 2)), bool>);
static_assert(std::is_same_v<decltype(logicalOrVoid(1, 2)), bool>);
#endif
return 0;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -Xclang -verify=expected -Xclang -verify-ignore-unexpected=note -fpreview-breaking-changes -fsyntax-only -fsycl-device-only -ferror-limit=0 %s
// RUN: %clangxx -fsycl -Xclang -verify=expected -Xclang -verify-ignore-unexpected=note -fsyntax-only -fsycl-device-only -ferror-limit=0 %s

#include <sycl/group_algorithm.hpp>

Expand Down