[llvm] [ADT] Refine MutableArrayRef forwarding constructor constraints (PR #183806)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 14:50:57 PST 2026


================
@@ -468,6 +468,10 @@ TEST(ArrayRefTest, MutableArrayRefDeductionGuides) {
   }
 }
 
+static_assert(
+    !std::is_constructible_v<MutableArrayRef<int>, const SmallVector<int>>,
+    "cannot construct MutableArrayRef from const std::SmallVector<int>");
+
----------------
kuhar wrote:

Can you also add a static assert for `std::is_constructible_v<MutableArrayRef<Base>, std::span< Derived>` (shouldn't be allowed)? This is so that we have coverage for that double pointer trick in enable_if.

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


More information about the llvm-commits mailing list