================
@@ -198,4 +198,33 @@ namespace lambdas {
   }
 }
 
-// FIXME: by-value array copies
+namespace by_value_array_copy {
+  struct explicit_copy {
+    explicit_copy() = default; // expected-note 2{{candidate constructor not 
viable: requires 0 arguments, but 1 was provided}}
+    explicit explicit_copy(const explicit_copy&) = default; // expected-note 
2{{explicit constructor is not a candidate}}
+  };
+
+  constexpr int direct_initialization_for_elements() {
+    int arr[3]{1, 2, 3};
+    auto [a1, b1, c1](arr);
+    explicit_copy ec_arr[2];
+    auto [a2, b2](ec_arr);
+    arr[0]--;
+    return a1 + b1 + c1 + arr[0];
+  }
+  static_assert(direct_initialization_for_elements() == 6);
+
+  void copy_initialization_for_elements() {
----------------
cor3ntin wrote:

Can you add a test to check that the elements are correctly set to their value? 
(like you do above)

https://github.com/llvm/llvm-project/pull/102581
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to