diff --git a/include/gsl/span b/include/gsl/span index 4681465..89574b2 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -772,10 +772,11 @@ template span::value> as_bytes(span s) noexcept { + using type = span::value>; + // clang-format off GSL_SUPPRESS(type.1) // NO-FORMAT: attribute // clang-format on - using type = span::value>; return type{reinterpret_cast(s.data()), s.size_bytes()}; } @@ -784,10 +785,11 @@ template ::value> as_writable_bytes(span s) noexcept { + using type = span::value>; + // clang-format off GSL_SUPPRESS(type.1) // NO-FORMAT: attribute // clang-format on - using type = span::value>; return type{reinterpret_cast(s.data()), s.size_bytes()}; } diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index 44198a6..ce881ba 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -1180,7 +1180,7 @@ TEST(span_test, from_array_constructor) #endif { auto f = [&]() { - span _s4{arr2, 2}; + const span _s4{arr2, 2}; static_cast(_s4); }; EXPECT_DEATH(f(), deathstring);