From cc7c2f7ee42623aef41c8cb45fe8d13f7bc87d7f Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 2 Aug 2022 22:44:34 +0300 Subject: [PATCH] Return v_.index() == 1 from has_error() to avoid -Wmaybe-uninitialized in error() --- include/boost/system/result.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/system/result.hpp b/include/boost/system/result.hpp index 4e6c00c..2e0ddc3 100644 --- a/include/boost/system/result.hpp +++ b/include/boost/system/result.hpp @@ -222,7 +222,7 @@ public: constexpr bool has_error() const noexcept { - return v_.index() != 0; + return v_.index() == 1; } constexpr explicit operator bool() const noexcept @@ -511,7 +511,7 @@ public: constexpr bool has_error() const noexcept { - return v_.index() != 0; + return v_.index() == 1; } constexpr explicit operator bool() const noexcept