From a191f57408817d669bf31adc4436ed0760fc2875 Mon Sep 17 00:00:00 2001 From: islander Date: Wed, 24 Jan 2024 00:04:33 +0800 Subject: [PATCH] [FIX] fix the behavior of flatbuffers::Optional to match std::optional when lhs and rhs are both nullopt --- include/flatbuffers/stl_emulation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/flatbuffers/stl_emulation.h b/include/flatbuffers/stl_emulation.h index 5f19eaf8d41..67c6768cbf2 100644 --- a/include/flatbuffers/stl_emulation.h +++ b/include/flatbuffers/stl_emulation.h @@ -273,7 +273,7 @@ template FLATBUFFERS_CONSTEXPR_CPP11 bool operator==(const Optional& lhs, const Optional& rhs) FLATBUFFERS_NOEXCEPT { return static_cast(lhs) != static_cast(rhs) ? false - : !static_cast(lhs) ? false : (*lhs == *rhs); + : !static_cast(lhs) ? true : (*lhs == *rhs); } #endif // FLATBUFFERS_USE_STD_OPTIONAL