Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlbckmnn2022-12-12 12:15:42 +0100
committerGitHub2022-12-12 12:15:42 +0100
commite3fc97dffbad63f49a90e5ae688b0ce0c282e8c2 (patch)
tree4241372abfbede0e7413cb57802dfcc1c703924c
parent9c0533a90504b2b1c308dc7cc77ff194f81046e2 (diff)
downloadcatch3-e3fc97dffbad63f49a90e5ae688b0ce0c282e8c2.tar.gz
fix compiler warning in parseUint and catch only relevant exceptions (#2572)
-rw-r--r--src/catch2/internal/catch_parse_numbers.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/catch2/internal/catch_parse_numbers.cpp b/src/catch2/internal/catch_parse_numbers.cpp
index 390b8c87..d949ac19 100644
--- a/src/catch2/internal/catch_parse_numbers.cpp
+++ b/src/catch2/internal/catch_parse_numbers.cpp
@@ -6,12 +6,12 @@
// SPDX-License-Identifier: BSL-1.0
-#include <catch2/internal/catch_parse_numbers.hpp>
-
#include <catch2/internal/catch_compiler_capabilities.hpp>
+#include <catch2/internal/catch_parse_numbers.hpp>
#include <catch2/internal/catch_string_manip.hpp>
#include <limits>
+#include <stdexcept>
namespace Catch {
@@ -39,11 +39,14 @@ namespace Catch {
return {};
}
return static_cast<unsigned int>(ret);
- } CATCH_CATCH_ANON( std::exception const& ) {
- // There was a larger issue with the input, e.g. the parsed
- // number would be too large to fit within ull.
- return {};
}
+ CATCH_CATCH_ANON( std::invalid_argument const& ) {
+ // no conversion could be performed
+ }
+ CATCH_CATCH_ANON( std::out_of_range const& ) {
+ // the input does not fit into an unsigned long long
+ }
+ return {};
}
} // namespace Catch