From 09e515984a98bd5482009fdc9fdf6a4a9afaa58f Mon Sep 17 00:00:00 2001 From: Lau Ching Jun Date: Thu, 22 Jun 2023 08:46:24 -0700 Subject: [PATCH 1/3] Workaround a release blocker after libc++ change The code breaks in C++20 mode after libc++ removes comparisons for `std::vector` and replaces them with 'operator <=>'. --- .../common/client_wrapper/include/flutter/encodable_value.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shell/platform/common/client_wrapper/include/flutter/encodable_value.h b/shell/platform/common/client_wrapper/include/flutter/encodable_value.h index 3b46f99f63c33..ff180a24af87f 100644 --- a/shell/platform/common/client_wrapper/include/flutter/encodable_value.h +++ b/shell/platform/common/client_wrapper/include/flutter/encodable_value.h @@ -215,6 +215,11 @@ class EncodableValue : public internal::EncodableValueVariant { } return std::get(*this); } + + // Avoid operator<=> problems with std::variant in C++20 mode. + friend bool operator<(const EncodableValue& lhs, const EncodableValue& rhs) { + return static_cast(lhs) < static_cast(rhs); + } }; } // namespace flutter From 34410f636b52b0aa4c395cd5d680126803dc03da Mon Sep 17 00:00:00 2001 From: Lau Ching Jun Date: Thu, 22 Jun 2023 10:53:52 -0700 Subject: [PATCH 2/3] Update comments --- .../common/client_wrapper/include/flutter/encodable_value.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/platform/common/client_wrapper/include/flutter/encodable_value.h b/shell/platform/common/client_wrapper/include/flutter/encodable_value.h index ff180a24af87f..7151b7e9f5af5 100644 --- a/shell/platform/common/client_wrapper/include/flutter/encodable_value.h +++ b/shell/platform/common/client_wrapper/include/flutter/encodable_value.h @@ -216,7 +216,8 @@ class EncodableValue : public internal::EncodableValueVariant { return std::get(*this); } - // Avoid operator<=> problems with std::variant in C++20 mode. + // Explicitly provide operator<, delegating to std::variant's operator<. + // This avoids operator<=> problems with std::variant in C++20 mode. friend bool operator<(const EncodableValue& lhs, const EncodableValue& rhs) { return static_cast(lhs) < static_cast(rhs); } From a788a9c0a9408459879309e482dfebbfe94bb4d6 Mon Sep 17 00:00:00 2001 From: Lau Ching Jun Date: Thu, 22 Jun 2023 11:27:33 -0700 Subject: [PATCH 3/3] Update comments --- .../common/client_wrapper/include/flutter/encodable_value.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/platform/common/client_wrapper/include/flutter/encodable_value.h b/shell/platform/common/client_wrapper/include/flutter/encodable_value.h index 7151b7e9f5af5..3a191205bbef2 100644 --- a/shell/platform/common/client_wrapper/include/flutter/encodable_value.h +++ b/shell/platform/common/client_wrapper/include/flutter/encodable_value.h @@ -217,7 +217,8 @@ class EncodableValue : public internal::EncodableValueVariant { } // Explicitly provide operator<, delegating to std::variant's operator<. - // This avoids operator<=> problems with std::variant in C++20 mode. + // There are issues with with the way the standard library-provided + // < and <=> comparisons interact with classes derived from variant. friend bool operator<(const EncodableValue& lhs, const EncodableValue& rhs) { return static_cast(lhs) < static_cast(rhs); }