From 0f8b71180fba1088ed9bbeaf318dad163cee06dd Mon Sep 17 00:00:00 2001 From: iS_lANDER <46716051+mikudehuane@users.noreply.github.com> Date: Wed, 29 May 2024 10:40:04 +0800 Subject: [PATCH] [FIX] fix the behavior of flatbuffers::Optional to match std::optional when lhs and rhs are both nullopt (#8223) Co-authored-by: islander Co-authored-by: Derek Bailey --- 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 5f19eaf8d..67c6768cb 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