[libcxx-commits] [libcxx] [libc++] Fix mdspan layout_left / layout_right conversion rank constraint (PR #192847)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Apr 19 05:44:36 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: eiytoq (eiytoq)
<details>
<summary>Changes</summary>
Fixes: #<!-- -->158316
---
Full diff: https://github.com/llvm/llvm-project/pull/192847.diff
2 Files Affected:
- (modified) libcxx/include/__mdspan/layout_left.h (+1-1)
- (modified) libcxx/include/__mdspan/layout_right.h (+1-1)
``````````diff
diff --git a/libcxx/include/__mdspan/layout_left.h b/libcxx/include/__mdspan/layout_left.h
index fb1b59555b254..ce4e83fe7a8ee 100644
--- a/libcxx/include/__mdspan/layout_left.h
+++ b/libcxx/include/__mdspan/layout_left.h
@@ -94,7 +94,7 @@ class layout_left::mapping {
}
template <class _OtherExtents>
- requires(is_constructible_v<extents_type, _OtherExtents> && _OtherExtents::rank() <= 1)
+ requires(extents_type::rank() <= 1 && is_constructible_v<extents_type, _OtherExtents>)
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherExtents, extents_type>)
mapping(const layout_right::mapping<_OtherExtents>& __other) noexcept
: __extents_(__other.extents()) {
diff --git a/libcxx/include/__mdspan/layout_right.h b/libcxx/include/__mdspan/layout_right.h
index 7cb828022ea8e..16fb10bb46145 100644
--- a/libcxx/include/__mdspan/layout_right.h
+++ b/libcxx/include/__mdspan/layout_right.h
@@ -94,7 +94,7 @@ class layout_right::mapping {
}
template <class _OtherExtents>
- requires(is_constructible_v<extents_type, _OtherExtents> && _OtherExtents::rank() <= 1)
+ requires(extents_type::rank() <= 1 && is_constructible_v<extents_type, _OtherExtents>)
_LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherExtents, extents_type>)
mapping(const layout_left::mapping<_OtherExtents>& __other) noexcept
: __extents_(__other.extents()) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/192847
More information about the libcxx-commits
mailing list