[libcxx-commits] [libcxx] [libc++] Implement LWG4072: std::optional comparisons: constrain harder (PR #209968)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Aug 1 05:47:42 PDT 2026
================
@@ -29,6 +29,9 @@ static_assert(HasOperatorEqual<std::optional<EqualityComparable>, std::optional<
static_assert(!HasOperatorEqual<std::optional<NonComparable>>);
static_assert(!HasOperatorEqual<std::optional<EqualityComparable>, std::optional<NonComparable>>);
+static_assert(!HasOperatorEqual<std::optional<void*>, std::optional<int>>);
+static_assert(!HasOperatorEqual<std::optional<int>, std::optional<void*>>);
+
----------------
Zingam wrote:
Please check the synopsis above. This test is testing the optional to optional comparison operators [[optional.relops]](https://wg21.link/optional.relops) and the changes you make are related to optional comparison with a value, which means this is the wrong section [[optional.comp.with.t]](https://wg21.link/optional.comp.with.t)
The correct would be: libcxx/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp
I think these test should be moved with a note regarding LWG4072, since this should be testing the constraint that there is no ambiguity?
@frederick-vs-ja WDYT?
https://github.com/llvm/llvm-project/pull/209968
More information about the libcxx-commits
mailing list