[llvm] [ArrayRef] Make iterator_range constructor const-agnostic (PR #205183)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 3 08:10:29 PDT 2026


================
@@ -348,14 +348,22 @@ static_assert(!std::is_constructible_v<MutableArrayRef<TestBase *>,
               "cannot construct MutableArrayRef pointer of base type");
 
 static_assert(
-    !std::is_constructible_v<ArrayRef<int>, iterator_range<const int *>>,
-    "cannot construct ArrayRef with non-const elements from const iterator "
-    "range");
+    std::is_constructible_v<ArrayRef<int>, iterator_range<const int *>>,
----------------
fhahn wrote:

Not sure if we have this covered already, but would be good to make sure we have something like below, to make sure we do not strip const when constructing ArrayRef<T *>

```
  static_assert(
      !std::is_constructible_v<ArrayRef<int *>, iterator_range<const int **>>,
      "cannot strip const off the pointee when constructing ArrayRef over pointers");
```

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


More information about the llvm-commits mailing list