diff --git a/include/gsl/span b/include/gsl/span index 445826c..20f4237 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -430,7 +430,7 @@ public: constexpr span(pointer firstElem, pointer lastElem) noexcept : storage_(firstElem, static_cast(std::distance(firstElem, lastElem))) { - if (Extent != dynamic_extent) { Expects(lastElem - firstElem == Extent); } + if (Extent != dynamic_extent) { Expects(lastElem - firstElem == static_cast(Extent)); } } template diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index 8c5ac0d..1f5020b 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -1550,10 +1550,10 @@ TEST(span_test, from_array_constructor) // even when done dynamically { - span s = arr; /* // this now results in a compile-time error, rather than runtime. // There is no suitable conversion from dynamic span to fixed span. + span s = arr; auto f = [&]() { const span s2 = s; static_cast(s2);