[libcxx-commits] [libcxx] [libc++] Implement LWG4072: std::optional comparisons: constrain harder (PR #209968)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 30 02:51:43 PDT 2026


================
@@ -1543,7 +1543,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(const optional<_Tp>&
 template <
     class _Tp,
     class _Up,
-    enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
+    enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool> &&
+                    !__is_std_optional<_Up>::value,
----------------
Zingam wrote:

> Thank you for the feedback, I've amended the commit with the proposed fix.

Please, make sure to clang-format your changes before submitting but be careful not to format unrelated stuff. If needed unrelated changes are delegated to separate PRs.

https://github.com/llvm/llvm-project/pull/209968


More information about the libcxx-commits mailing list