Index: include/span =================================================================== --- include/span +++ include/span @@ -223,20 +223,6 @@ _LIBCPP_INLINE_VISIBILITY constexpr span( array& __arr) noexcept : __data{__arr.data()} {} _LIBCPP_INLINE_VISIBILITY constexpr span(const array& __arr) noexcept : __data{__arr.data()} {} - template - inline _LIBCPP_INLINE_VISIBILITY - constexpr span( _Container& __c, - enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr) - : __data{_VSTD::data(__c)} - { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (container)"); } - - template - inline _LIBCPP_INLINE_VISIBILITY - constexpr span(const _Container& __c, - enable_if_t<__is_span_compatible_container::value, nullptr_t> = nullptr) - : __data{_VSTD::data(__c)} - { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (const container)"); } - template inline _LIBCPP_INLINE_VISIBILITY constexpr span(const span<_OtherElementType, _Extent>& __other, Index: test/std/containers/views/span.cons/container.fail.cpp =================================================================== --- test/std/containers/views/span.cons/container.fail.cpp +++ test/std/containers/views/span.cons/container.fail.cpp @@ -17,6 +17,7 @@ // constexpr span(const Container& cont); // // Remarks: These constructors shall not participate in overload resolution unless: +// — extent == dynamic_extent, // — Container is not a specialization of span, // — Container is not a specialization of array, // — is_array_v is false, @@ -69,30 +70,22 @@ // Missing size and/or data { std::span s1{IsAContainer()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span s2{IsAContainer()}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s3{NotAContainerNoData()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span s4{NotAContainerNoData()}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s5{NotAContainerNoSize()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span s6{NotAContainerNoSize()}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s7{NotAContainerPrivate()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span s8{NotAContainerPrivate()}; // expected-error {{no matching constructor for initialization of 'std::span'}} // Again with the standard containers std::span s11{std::deque()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span s12{std::deque()}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s13{std::list()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span s14{std::list()}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s15{std::forward_list()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span s16{std::forward_list()}; // expected-error {{no matching constructor for initialization of 'std::span'}} } // Not the same type { std::span s1{IsAContainer()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span s2{IsAContainer()}; // expected-error {{no matching constructor for initialization of 'std::span'}} } -// CV wrong (dynamically sized) +// CV wrong { std::span< int> s1{IsAContainer()}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< int> s2{IsAContainer< volatile int>()}; // expected-error {{no matching constructor for initialization of 'std::span'}} @@ -103,15 +96,6 @@ std::span< volatile int> s7{IsAContainer()}; // expected-error {{no matching constructor for initialization of 'std::span'}} } -// CV wrong (statically sized) - { - std::span< int,1> s1{IsAContainer()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span< int,1> s2{IsAContainer< volatile int>()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span< int,1> s3{IsAContainer()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span s4{IsAContainer< volatile int>()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span s5{IsAContainer()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span< volatile int,1> s6{IsAContainer()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - std::span< volatile int,1> s7{IsAContainer()}; // expected-error {{no matching constructor for initialization of 'std::span'}} - } - +// statically sized + std::span s1{IsAContainer()}; // expected-error {{no matching constructor for initialization of 'std::span'}} } Index: test/std/containers/views/span.cons/container.pass.cpp =================================================================== --- test/std/containers/views/span.cons/container.pass.cpp +++ test/std/containers/views/span.cons/container.pass.cpp @@ -17,6 +17,7 @@ // constexpr span(const Container& cont); // // Remarks: These constructors shall not participate in overload resolution unless: +// — extent == dynamic_extent, // — Container is not a specialization of span, // — Container is not a specialization of array, // — is_array_v is false, @@ -49,31 +50,18 @@ { std::vector v = {1,2,3}; -// Types the same (dynamic sized) +// Types the same { std::span< int> s1{v}; // a span< int> pointing at int. } -// Types the same (static sized) +// types different { - std::span< int,3> s1{v}; // a span< int> pointing at int. - } - -// types different (dynamic sized) - { std::span s1{v}; // a span pointing at int. std::span< volatile int> s2{v}; // a span< volatile int> pointing at int. std::span< volatile int> s3{v}; // a span< volatile int> pointing at const int. std::span s4{v}; // a span pointing at int. } - -// types different (static sized) - { - std::span s1{v}; // a span pointing at int. - std::span< volatile int,3> s2{v}; // a span< volatile int> pointing at int. - std::span< volatile int,3> s3{v}; // a span< volatile int> pointing at const int. - std::span s4{v}; // a span pointing at int. - } } @@ -82,10 +70,7 @@ { constexpr IsAContainer val{}; std::span s1{val}; - std::span s2{val}; - return - s1.data() == val.getV() && s1.size() == 1 - && s2.data() == val.getV() && s2.size() == 1; + return s1.data() == val.getV() && s1.size() == 1; } @@ -94,9 +79,7 @@ { IsAContainer val{}; std::span s1{val}; - std::span s2{val}; assert(s1.data() == val.getV() && s1.size() == 1); - assert(s2.data() == val.getV() && s2.size() == 1); } struct A{};