[libcxx-commits] [libcxx] [libc++] restrict the expected conversion constructor not compete against copy constructor (PR #96101)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 21 08:51:20 PDT 2024


================
@@ -507,7 +507,9 @@ class expected : private __expected_base<_Tp, _Err> {
       _And< is_constructible<_Tp, _UfQual>,
             is_constructible<_Err, _OtherErrQual>,
             _If<_Not<is_same<remove_cv_t<_Tp>, bool>>::value,
-                _And< _Not<is_constructible<_Tp, expected<_Up, _OtherErr>&>>,
+                _And< 
+                      _Not<_And<is_same<_Tp, _Up>, is_same<_Err, _OtherErr>>>,
----------------
ldionne wrote:

Can you please leave a comment?

```suggestion
                      _Not<_And<is_same<_Tp, _Up>, is_same<_Err, _OtherErr>>>, // use the copy constructor instead, see #92676
```

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


More information about the libcxx-commits mailing list