diff --git a/include/gsl/span b/include/gsl/span index 25e244f..f61fd11 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -624,11 +624,7 @@ public: // [span.obs], span observers constexpr size_type size() const noexcept { return storage_.size(); } - constexpr size_type size_bytes() const noexcept - { - Expects(size() < dynamic_extent / sizeof(element_type)); - return size() * sizeof(element_type); - } + constexpr size_type size_bytes() const noexcept { return size() * sizeof(element_type); } constexpr bool empty() const noexcept { return size() == 0; } diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index 5a9fc6e..44ae205 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -1116,12 +1116,6 @@ TEST(span_test, rbegin_rend) TEST(span_test, as_bytes) { - const auto terminateHandler = std::set_terminate([] { - std::cerr << "Expected Death. as_bytes"; - std::abort(); - }); - const auto expected = GetExpectedDeathString(terminateHandler); - int a[] = {1, 2, 3, 4}; { const span s = a; @@ -1147,12 +1141,6 @@ TEST(span_test, as_bytes) EXPECT_TRUE(static_cast(bs.data()) == static_cast(s.data())); EXPECT_TRUE(bs.size() == s.size_bytes()); } - - int b[5] = {1, 2, 3, 4, 5}; - { - span sp(std::begin(b), static_cast(-2)); - EXPECT_DEATH((void) sp.size_bytes(), expected); - } } TEST(span_test, as_writable_bytes)