[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:57:56 PDT 2024


================
@@ -109,6 +120,13 @@ constexpr bool test() {
     assert(!e2.has_value());
   }
 
+  {
+    // https://github.com/llvm/llvm-project/issues/92676
+    std::expected<Any, int> e1;
+    auto e2 = e1;
+    assert(e2.has_value());
+  }
----------------
ldionne wrote:

```suggestion
  {
    // TODO(LLVM 20): Remove once we drop support for Clang 17
    #if defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 1700
    // https://github.com/llvm/llvm-project/issues/92676
    std::expected<Any, int> e1;
    auto e2 = e1;
    assert(e2.has_value());
    #endif
  }
```

I don't think it's a big deal, after all this code didn't compile anyway before your fix.

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


More information about the libcxx-commits mailing list