diff --git a/docs/headers.md b/docs/headers.md index fb9ccba..566bbbd 100644 --- a/docs/headers.md +++ b/docs/headers.md @@ -485,6 +485,9 @@ constexpr span(const span& other) noexcept; Constructs a `span` from another `span`. This constructor is available if `OtherExtent == Extent || Extent ==`[`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent)` || OtherExtent ==`[`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent) and if `ElementType` and `OtherElementType` are compatible. +If `Extent !=`[`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent) and `OtherExtent ==`[`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent), +then the constructor [`Expects`](#user-content-H-assert-expects) that `other.size() == Extent`. + ```cpp constexpr span& operator=(const span& other) noexcept = default; ``` diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index ebff22e..efe0195 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -681,6 +681,13 @@ TEST(span_test, from_convertible_span_constructor) static_cast(avcd); } + { + std::array arr{}; + span avd{arr}; + using T = span; + EXPECT_DEATH(T{avd}, expected); + } + { std::array arr{}; span avd{arr};