From faf5984448f0dd76a9da93d30cd23e366f059d8a Mon Sep 17 00:00:00 2001 From: Jeroen Vermeulen Date: Tue, 26 Nov 2024 13:56:53 +0100 Subject: [PATCH] Drop assertion in workaround for `std::unreachable`. (#908) In environments where `std::unreachable` is not available, we previously _asserted_ that the code was not reached. Which I guess was useful in the early days for exposing any mixups, but doesn't really set the same expectations as `std::unreachable` itself. So, drop that assertion. This also gets rid of a bunch of warnings from my static checker about "this could be a `static_assert`." --- include/pqxx/util.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pqxx/util.hxx b/include/pqxx/util.hxx index 4afe3026b..b548d7c04 100644 --- a/include/pqxx/util.hxx +++ b/include/pqxx/util.hxx @@ -47,9 +47,9 @@ namespace pqxx // C++23: Retire wrapper. // PQXX_UNREACHABLE: equivalent to `std::unreachable()` if available. #if !defined(__cpp_lib_unreachable) -# define PQXX_UNREACHABLE assert(false) +# define PQXX_UNREACHABLE while (false) #elif !__cpp_lib_unreachable -# define PQXX_UNREACHABLE assert(false) +# define PQXX_UNREACHABLE while (false) #else # define PQXX_UNREACHABLE std::unreachable() #endif