Skip to content

Commit 2aba433

Browse files
committed
fix build: fix MonotonicConcurrentSet kNullTable being non-constexpr-able
commit_hash:2858f97bbcd9b497a6e6544557c760589325be72
1 parent 419345b commit 2aba433

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

universal/include/userver/utils/span.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ class span final { // NOLINT(readability-identifier-naming)
3535
constexpr span() noexcept : span(nullptr, nullptr) {}
3636

3737
constexpr span(T* begin, T* end) noexcept : begin_(begin), end_(end) {
38-
UASSERT((begin != nullptr && end != nullptr && begin <= end) || (begin == nullptr && end == nullptr));
38+
// GCC 11.4.0 has issues with comparing pointers at compile time.
39+
UASSERT(
40+
std::is_constant_evaluated() || (begin != nullptr && end != nullptr && begin <= end) ||
41+
(begin == nullptr && end == nullptr)
42+
);
3943
}
4044

4145
constexpr span(T* begin, std::size_t size) noexcept : begin_(begin), end_(begin + size) {
42-
UASSERT(begin != nullptr || size == 0);
46+
// GCC 11.4.0 has issues with comparing pointers at compile time.
47+
UASSERT(std::is_constant_evaluated() || begin != nullptr || size == 0);
4348
}
4449

4550
#if defined(__GNUC__) && !defined(__clang__)

0 commit comments

Comments
 (0)