[libcxx] [llvm] [libc++] Implement P3379R0 Constrain `std::expected` equality operators (PR #135759)
A. Jiang via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 22 20:06:38 PDT 2025
================
@@ -0,0 +1,31 @@
+#ifndef _LIBCPP___CONCEPTS_CORE_CONVERTIBLE_TO_H
+#define _LIBCPP___CONCEPTS_CORE_CONVERTIBLE_TO_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 20
+
+// [conv.general]/3 says "E is convertible to T" whenever "T t=E;" is well-formed.
+// We can't test for that, but we can test implicit convertibility by passing it
+// to a function. Unlike std::convertible_to, __core_convertible_to doesn't test
+// static_cast or handle cv void, while accepting move-only types.
----------------
frederick-vs-ja wrote:
Move-only types can be handled by `std::convertible_to`. I guess non-movable types should be mentioned.
```suggestion
// static_cast or handle cv void, while accepting non-movable types.
```
https://github.com/llvm/llvm-project/pull/135759
More information about the llvm-commits
mailing list