Delete the useless 'noexcept(false)' (#1152)
Some checks are pending
CI_Android / Android (push) Waiting to run
cmake_find_package / Build ${{ matrix.os }} (macos-latest) (push) Waiting to run
cmake_find_package / Build ${{ matrix.os }} (ubuntu-latest) (push) Waiting to run
Compiler Integration Tests / gcc (Debug, 14, 10) (push) Waiting to run
Compiler Integration Tests / gcc (Debug, 14, 11) (push) Waiting to run
Compiler Integration Tests / gcc (Debug, 14, 12) (push) Waiting to run
Compiler Integration Tests / gcc (Debug, 17, 10) (push) Waiting to run
Compiler Integration Tests / gcc (Debug, 17, 11) (push) Waiting to run
Compiler Integration Tests / gcc (Debug, 17, 12) (push) Waiting to run
Compiler Integration Tests / gcc (Debug, 20, 10) (push) Waiting to run
Compiler Integration Tests / gcc (Debug, 20, 11) (push) Waiting to run
Compiler Integration Tests / gcc (Debug, 20, 12) (push) Waiting to run
Compiler Integration Tests / gcc (Debug, 23, 11) (push) Waiting to run
Compiler Integration Tests / gcc (Debug, 23, 12) (push) Waiting to run
Compiler Integration Tests / gcc (Release, 14, 10) (push) Waiting to run
Compiler Integration Tests / gcc (Release, 14, 11) (push) Waiting to run
Compiler Integration Tests / gcc (Release, 14, 12) (push) Waiting to run
Compiler Integration Tests / gcc (Release, 17, 10) (push) Waiting to run
Compiler Integration Tests / gcc (Release, 17, 11) (push) Waiting to run
Compiler Integration Tests / gcc (Release, 17, 12) (push) Waiting to run
Compiler Integration Tests / gcc (Release, 20, 10) (push) Waiting to run
Compiler Integration Tests / gcc (Release, 20, 11) (push) Waiting to run
Compiler Integration Tests / gcc (Release, 20, 12) (push) Waiting to run
Compiler Integration Tests / gcc (Release, 23, 11) (push) Waiting to run
Compiler Integration Tests / gcc (Release, 23, 12) (push) Waiting to run
Compiler Integration Tests / clang (Debug, 13, 14) (push) Waiting to run
Compiler Integration Tests / clang (Debug, 13, 17) (push) Waiting to run
Compiler Integration Tests / clang (Debug, 13, 20) (push) Waiting to run
Compiler Integration Tests / clang (Debug, 13, 23) (push) Waiting to run
Compiler Integration Tests / clang (Debug, 14, 14) (push) Waiting to run
Compiler Integration Tests / clang (Debug, 14, 17) (push) Waiting to run
Compiler Integration Tests / clang (Debug, 14, 20) (push) Waiting to run
Compiler Integration Tests / clang (Debug, 14, 23) (push) Waiting to run
Compiler Integration Tests / clang (Debug, 15, 14) (push) Waiting to run
Compiler Integration Tests / clang (Debug, 15, 17) (push) Waiting to run
Compiler Integration Tests / clang (Debug, 15, 20) (push) Waiting to run
Compiler Integration Tests / clang (Debug, 15, 23) (push) Waiting to run
Compiler Integration Tests / clang (Release, 13, 14) (push) Waiting to run
Compiler Integration Tests / clang (Release, 13, 17) (push) Waiting to run
Compiler Integration Tests / clang (Release, 13, 20) (push) Waiting to run
Compiler Integration Tests / clang (Release, 13, 23) (push) Waiting to run
Compiler Integration Tests / clang (Release, 14, 14) (push) Waiting to run
Compiler Integration Tests / clang (Release, 14, 17) (push) Waiting to run
Compiler Integration Tests / clang (Release, 14, 20) (push) Waiting to run
Compiler Integration Tests / clang (Release, 14, 23) (push) Waiting to run
Compiler Integration Tests / clang (Release, 15, 14) (push) Waiting to run
Compiler Integration Tests / clang (Release, 15, 17) (push) Waiting to run
Compiler Integration Tests / clang (Release, 15, 20) (push) Waiting to run
Compiler Integration Tests / clang (Release, 15, 23) (push) Waiting to run
Compiler Integration Tests / xcode (Debug, 14, 14.3.1) (push) Waiting to run
Compiler Integration Tests / xcode (Debug, 14, 15.4) (push) Waiting to run
Compiler Integration Tests / xcode (Debug, 17, 14.3.1) (push) Waiting to run
Compiler Integration Tests / xcode (Debug, 17, 15.4) (push) Waiting to run
Compiler Integration Tests / xcode (Debug, 20, 14.3.1) (push) Waiting to run
Compiler Integration Tests / xcode (Debug, 20, 15.4) (push) Waiting to run
Compiler Integration Tests / xcode (Debug, 23, 14.3.1) (push) Waiting to run
Compiler Integration Tests / xcode (Debug, 23, 15.4) (push) Waiting to run
Compiler Integration Tests / xcode (Release, 14, 14.3.1) (push) Waiting to run
Compiler Integration Tests / xcode (Release, 14, 15.4) (push) Waiting to run
Compiler Integration Tests / xcode (Release, 17, 14.3.1) (push) Waiting to run
Compiler Integration Tests / xcode (Release, 17, 15.4) (push) Waiting to run
Compiler Integration Tests / xcode (Release, 20, 14.3.1) (push) Waiting to run
Compiler Integration Tests / xcode (Release, 20, 15.4) (push) Waiting to run
Compiler Integration Tests / xcode (Release, 23, 14.3.1) (push) Waiting to run
Compiler Integration Tests / xcode (Release, 23, 15.4) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 14, , Visual Studio 16 2019, windows-2019) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 14, , Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 14, -T ClangCL, Visual Studio 16 2019, windows-2019) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 14, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 17, , Visual Studio 16 2019, windows-2019) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 17, , Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 17, -T ClangCL, Visual Studio 16 2019, windows-2019) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 17, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 20, , Visual Studio 16 2019, windows-2019) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 20, , Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 20, -T ClangCL, Visual Studio 16 2019, windows-2019) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 20, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 23, , Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Debug, 23, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 14, , Visual Studio 16 2019, windows-2019) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 14, , Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 14, -T ClangCL, Visual Studio 16 2019, windows-2019) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 14, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 17, , Visual Studio 16 2019, windows-2019) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 17, , Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 17, -T ClangCL, Visual Studio 16 2019, windows-2019) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 17, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 20, , Visual Studio 16 2019, windows-2019) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 20, , Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 20, -T ClangCL, Visual Studio 16 2019, windows-2019) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 20, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 23, , Visual Studio 17 2022, windows-2022) (push) Waiting to run
Compiler Integration Tests / VisualStudio (Release, 23, -T ClangCL, Visual Studio 17 2022, windows-2022) (push) Waiting to run
CI_iOS / iOS (push) Waiting to run

This commit is contained in:
mq白 2024-10-15 04:30:40 +08:00 committed by GitHub
parent 84b2ca1352
commit 32511b8de4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,13 +30,12 @@ struct narrowing_error : public std::exception
template <class T, class U, typename std::enable_if<std::is_arithmetic<T>::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<T>::value != std::is_signed<U>::value);
@ -67,9 +66,8 @@ GSL_SUPPRESS(p.2) // NO-FORMAT: attribute // don't rely on undefined behavior
template <class T, class U, typename std::enable_if<!std::is_arithmetic<T>::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<T>(u);