[llvm] Add const check (PR #181190)
Dmitrii Makarenko via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 12 12:47:14 PST 2026
Devjiu wrote:
@d0k looks like
```
/vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/unittests/ADT/ArrayRefTest.cpp:492:5: error: static assertion failed due to requirement 'std::is_constructible_v<llvm::MutableArrayRef<int>, std::span<int, 18446744073709551615>>': should be able to construct MutableArrayRef from mutable std::span
492 | std::is_constructible_v<MutableArrayRef<int>, std::span<int>>,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
705.300 [802/17/503] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/APFixedPointTest.cpp.o
```
I've broken this check with span. I don't know how MutableArrayRef should work with rvalues - as it doesn't own data, so moving to the constructor with `constexpr MutableArrayRef(C &&V) `, and binding to temporaries would risk dangling references.
We can add specific constructor for span or modify the static check somehow.
https://github.com/llvm/llvm-project/pull/181190
More information about the llvm-commits
mailing list