From 065c1dc2d7d661d38b7fb784381d0d1b11726094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=92=E6=95=85=E9=87=8C?= <3326284481@qq.com> Date: Wed, 15 May 2024 10:34:53 +0800 Subject: [PATCH] Delete the useless 'noexcept(false)' --- include/gsl/narrow | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/gsl/narrow b/include/gsl/narrow index 5c87087..7b1a791 100644 --- a/include/gsl/narrow +++ b/include/gsl/narrow @@ -30,13 +30,12 @@ struct narrowing_error : public std::exception template ::value>::type* = nullptr> // clang-format off GSL_SUPPRESS(type.1) // NO-FORMAT: attribute -GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false) GSL_SUPPRESS(es.46) // NO-FORMAT: attribute // The warning suggests that a floating->unsigned conversion can occur // in the static_cast below, and that gsl::narrow should be used instead. // Suppress this warning, since gsl::narrow is defined in terms of // static_cast // clang-format on - constexpr T narrow(U u) noexcept(false) + constexpr T narrow(U u) { constexpr const bool is_different_signedness = (std::is_signed::value != std::is_signed::value); @@ -67,9 +66,8 @@ GSL_SUPPRESS(p.2) // NO-FORMAT: attribute // don't rely on undefined behavior template ::value>::type* = nullptr> // clang-format off GSL_SUPPRESS(type.1) // NO-FORMAT: attribute -GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false) // clang-format on - constexpr T narrow(U u) noexcept(false) + constexpr T narrow(U u) { const T t = narrow_cast(u);