[libcxx-commits] [libcxx] [libc++] Fix std::variant evaluating template arguments too eagerly (PR #151028)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 31 06:19:47 PDT 2025


================
@@ -173,12 +173,28 @@ void test_vector_bool() {
   assert(std::get<0>(v) == true);
 }
 
+struct ConvertibleFromAny {
+  template <class V>
+  ConvertibleFromAny(V) {}
+};
+
 int main(int, char**) {
   test_T_ctor_basic();
   test_T_ctor_noexcept();
   test_T_ctor_sfinae();
   test_no_narrowing_check_for_class_types();
   test_construction_with_repeated_types();
   test_vector_bool();
+
+  { // Check that the constraints are evaluated lazily
----------------
ldionne wrote:

```suggestion
  { // Check that the constraints are evaluated lazily (see https://github.com/llvm/llvm-project/issues/151328)
```

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


More information about the libcxx-commits mailing list