diff --git a/include/gsl/span b/include/gsl/span index fbb3758..f8dd4a0 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -163,7 +163,7 @@ namespace details constexpr span_iterator operator++(int) noexcept { - span_iterator ret = {*this}; + auto ret{*this}; ++*this; return ret; } @@ -178,7 +178,7 @@ namespace details constexpr span_iterator operator--(int) noexcept { - span_iterator ret = {*this}; + auto ret{*this}; --*this; return ret; } @@ -194,7 +194,7 @@ namespace details constexpr span_iterator operator+(const difference_type n) const noexcept { - span_iterator ret = {*this}; + auto ret{*this}; return ret += n; } @@ -215,7 +215,7 @@ namespace details constexpr span_iterator operator-(const difference_type n) const noexcept { - span_iterator ret = {*this}; + auto ret{*this}; return ret -= n; } diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index 9dbfb42..c1dbbef 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -1102,8 +1102,13 @@ TEST(span_test, from_array_constructor) { span s = a; span s2 = b; - EXPECT_DEATH(bool _ = (s.begin() == s2.begin()), deathstring); - EXPECT_DEATH(bool _ = (s.begin() <= s2.begin()), deathstring); +#if (__cplusplus > 201402L) + EXPECT_DEATH([[maybe_unused]] s.begin() == s2.begin(), deathstring); + EXPECT_DEATH([[maybe_unused]] s.begin() <= s2.begin(), deathstring); +#else + EXPECT_DEATH(s.begin() == s2.begin(), deathstring); + EXPECT_DEATH(s.begin() <= s2.begin(), deathstring); +#endif } }