Skip to content

Commit 490eb2e

Browse files
committed
Fix failure to compile span polyfill on clang on Ubuntu 22.04.
1 parent a712165 commit 490eb2e

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

include/quickcpplib/span.hpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Distributed under the Boost Software License, Version 1.0.
3333
#include "config.hpp"
3434

3535
#if !defined(QUICKCPPLIB_USE_STD_SPAN)
36-
#if (_HAS_CXX20 || __cplusplus >= 202002L) && __cpp_lib_span >= 202002L
36+
#if(_HAS_CXX20 || __cplusplus >= 202002L) && __cpp_lib_span >= 202002L
3737
#define QUICKCPPLIB_USE_STD_SPAN 1
3838
#else
3939
#define QUICKCPPLIB_USE_STD_SPAN 0
@@ -70,10 +70,12 @@ namespace span
7070
// construction of spans from vectors. Let's add a constructor to fix that, even though it'll
7171
// break double implicit conversions :(
7272
template <class U>
73-
requires(
74-
!std::is_same_v<std::decay_t<U>, span> && !std::is_same_v<std::decay_t<U>, _base> && !std::is_same_v<std::decay_t<U>, _const_base> &&
75-
std::is_convertible<typename std::decay_t<U>::pointer, typename _base::pointer>::value && requires { declval<U>().data(); } &&
76-
requires { declval<U>().size(); }) constexpr span(U &&v) noexcept
73+
requires(
74+
!std::is_same_v<std::decay_t<U>, span> && !std::is_same_v<std::decay_t<U>, _base> &&
75+
!std::is_same_v<std::decay_t<U>, _const_base> &&
76+
std::is_convertible<typename std::decay_t<U>::pointer, typename _base::pointer>::value &&
77+
requires { declval<U>().data(); } && requires { declval<U>().size(); })
78+
constexpr span(U &&v) noexcept
7779
: _base(v.data(), v.size())
7880
{
7981
}
@@ -86,7 +88,9 @@ namespace span
8688

8789
QUICKCPPLIB_NAMESPACE_END
8890

89-
#else // ^^^ QUICKCPPLIB_USE_STD_SPAN / not QUICKCPPLIB_USE_STD_SPAN vvv
91+
#else // ^^^ QUICKCPPLIB_USE_STD_SPAN / not QUICKCPPLIB_USE_STD_SPAN vvv
92+
93+
#include <exception> // for std::terminate()
9094

9195
#if QUICKCPPLIB_USE_SYSTEM_SPAN_LITE
9296
#include <nonstd/span.hpp>
@@ -103,6 +107,6 @@ namespace span
103107

104108
QUICKCPPLIB_NAMESPACE_END
105109

106-
#endif // ^^^ not QUICKCPPLIB_USE_STD_SPAN ^^^
110+
#endif // ^^^ not QUICKCPPLIB_USE_STD_SPAN ^^^
107111

108112
#endif

0 commit comments

Comments
 (0)