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
15 changes: 13 additions & 2 deletions stl/inc/compare
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,19 @@ _STL_DISABLE_CLANG_WARNINGS
#undef new

_STD_BEGIN
using _Literal_zero = decltype(nullptr);
using _Compare_t = signed char;
void _Literal_zero_is_expected();

struct _Literal_zero {
template <class _Ty, enable_if_t<is_same_v<_Ty, int>, int> = 0>
consteval _Literal_zero(_Ty _Zero) noexcept {
// Can't use _STL_VERIFY because this is a core header
if (_Zero != 0) {
_Literal_zero_is_expected();
}
}
};

using _Compare_t = signed char;
Comment thread
fsb4000 marked this conversation as resolved.

// These "pretty" enumerator names are safe since they reuse names of user-facing entities.
enum class _Compare_eq : _Compare_t { equal = 0, equivalent = equal };
Expand Down
5 changes: 5 additions & 0 deletions tests/std/tests/P0768R1_spaceship_operator/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
#include <compare>
#include <type_traits>

// See GH-3581 for details
#ifdef __clang__
#pragma clang diagnostic error "-Wzero-as-null-pointer-constant"
#endif // __clang__
Comment thread
fsb4000 marked this conversation as resolved.

enum class comp { equal, less, greater, unordered };

template <comp Z, class T>
Expand Down