File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1164,7 +1164,7 @@ class span
11641164 : data_( other.data() )
11651165 , size_( other.size() )
11661166 {
1167- span_EXPECTS ( OtherExtent == dynamic_extent || other.size () == to_size (OtherExtent ) );
1167+ span_EXPECTS ( Extent == dynamic_extent || Extent != dynamic_extent && other.size () == to_size (Extent ) );
11681168 }
11691169
11701170 // 26.7.3.3 Subviews [span.sub]
Original file line number Diff line number Diff line change @@ -2239,6 +2239,16 @@ CASE( "[hide][issue-69: constructor from iterators is not properly constrained]"
22392239#endif
22402240}
22412241
2242+ CASE ( " [hide][issue-89: disallow construction of static-sized span from dynamic span with different size: precondition violation]" )
2243+ {
2244+ int data3[] = { 1 , 2 , 3 };
2245+
2246+ nonstd::span<int > dynamic_spn3 ( data3 );
2247+ nonstd::span<int , 2 > static_spn2 ( dynamic_spn3 ); // <== disallow: smaller static extent
2248+ nonstd::span<int , 3 > static_spn3 ( dynamic_spn3 ); // <== allow same extent, dynamic size
2249+ nonstd::span<int , 4 > static_spn4 ( dynamic_spn3 ); // <== disallow: larger static extent
2250+ }
2251+
22422252CASE ( " tweak header: reads tweak header if supported " " [tweak]" )
22432253{
22442254#if span_HAVE( TWEAK_HEADER )
You can’t perform that action at this time.
0 commit comments