From a78bd0abe451cde450bbc1eb56c1450b350dc255 Mon Sep 17 00:00:00 2001 From: "Klaus T. Aehlig" Date: Fri, 13 Jun 2025 16:37:40 +0200 Subject: Ensure equality operators are really noexcept. ... by explicitly catching any possible exception. Mainly to make clang-tidy happy. ... --- src/buildtool/file_system/file_root.hpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/buildtool/file_system/file_root.hpp') diff --git a/src/buildtool/file_system/file_root.hpp b/src/buildtool/file_system/file_root.hpp index 3384f55e..f8daa429 100644 --- a/src/buildtool/file_system/file_root.hpp +++ b/src/buildtool/file_system/file_root.hpp @@ -183,7 +183,20 @@ class FileRoot { friend auto operator==(Iterator const& x, Iterator const& y) noexcept -> bool { - return x.it_ == y.it_; + try { + return x.it_ == y.it_; + } catch (std::exception const& e) { + try { + Logger::Log(LogLevel::Error, + "Unexpected excpetion: {}", + e.what()); + std::terminate(); + } catch (...) { + std::terminate(); + } + } catch (...) { + std::terminate(); + } } friend auto operator!=(Iterator const& x, Iterator const& y) noexcept -> bool { -- cgit v1.2.3