diff --git a/libcxx/include/span b/libcxx/include/span --- a/libcxx/include/span +++ b/libcxx/include/span @@ -208,8 +208,8 @@ static constexpr size_type extent = _Extent; // [span.cons], span constructors, copy, assignment, and destructor - _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr} - { static_assert(_Extent == 0, "Can't default construct a statically sized span with size > 0"); } + template = nullptr> + _LIBCPP_INLINE_VISIBILITY constexpr span() noexcept : __data{nullptr} {} constexpr span (const span&) noexcept = default; constexpr span& operator=(const span&) noexcept = default; diff --git a/libcxx/test/std/containers/views/span.cons/default.fail.cpp b/libcxx/test/std/containers/views/span.cons/default.fail.cpp --- a/libcxx/test/std/containers/views/span.cons/default.fail.cpp +++ b/libcxx/test/std/containers/views/span.cons/default.fail.cpp @@ -13,7 +13,7 @@ // constexpr span() noexcept; // // Remarks: This constructor shall not participate in overload resolution -// unless Extent <= 0 is true. +// unless Extent == 0 || Extent == dynamic_extent is true. #include @@ -24,10 +24,7 @@ int main(int, char**) { - std::span s; // expected-error-re@span:* {{static_assert failed{{( due to requirement '.*')?}} "Can't default construct a statically sized span with size > 0"}} - -// TODO: This is what I want: -// eXpected-error {{no matching constructor for initialization of 'std::span'}} + std::span s; // expected-error {{no matching constructor for initialization of 'std::span'}} return 0; } diff --git a/libcxx/test/std/containers/views/span.cons/default.pass.cpp b/libcxx/test/std/containers/views/span.cons/default.pass.cpp --- a/libcxx/test/std/containers/views/span.cons/default.pass.cpp +++ b/libcxx/test/std/containers/views/span.cons/default.pass.cpp @@ -13,11 +13,28 @@ // constexpr span() noexcept; #include + #include +#include #include +#include #include "test_macros.h" +#ifdef __cpp_lib_concepts +#include +#endif // __cpp_lib_concepts + +static_assert( std::is_default_constructible_v>, ""); +static_assert( std::is_default_constructible_v>, ""); +static_assert(!std::is_default_constructible_v>, ""); + +#ifdef __cpp_lib_concepts +static_assert( std::default_constructible>, ""); +static_assert( std::default_constructible>, ""); +static_assert(!std::default_constructible>, ""); +#endif // __cpp_lib_concepts + void checkCV() { // Types the same (dynamic sized)