diff --git a/libcxx/include/__mdspan/extents.h b/libcxx/include/__mdspan/extents.h --- a/libcxx/include/__mdspan/extents.h +++ b/libcxx/include/__mdspan/extents.h @@ -171,11 +171,14 @@ _TStatic __static_val = _StaticValues::__get(__i); if (__static_val == _DynTag) { __dyn_vals_[_DynamicIdxMap::__get(__i)] = __values[__i]; - } - // Precondition check - else - _LIBCPP_ASSERT_UNCATEGORIZED(__values[__i] == static_cast<_TDynamic>(__static_val), - "extents construction: mismatch of provided arguments with static extents."); + } else + // Not catching this could lead to out of bounds errors later + // e.g. using my_mdspan_t = mdspan>; my_mdspan_t = m(new int[5], 5); + // Right-hand-side construction looks ok with allocation and size matchgin, + // but since (potentially elsewhere defined) my_mdspan_t has static size m now things its range is 10 not 5 + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + __values[__i] == static_cast<_TDynamic>(__static_val), + "extents construction: mismatch of provided arguments with static extents."); } } @@ -187,11 +190,14 @@ _TStatic __static_val = _StaticValues::__get(__i); if (__static_val == _DynTag) { __dyn_vals_[_DynamicIdxMap::__get(__i)] = static_cast<_TDynamic>(__vals[__i]); - } - // Precondition check - else - _LIBCPP_ASSERT_UNCATEGORIZED(static_cast<_TDynamic>(__vals[__i]) == static_cast<_TDynamic>(__static_val), - "extents construction: mismatch of provided arguments with static extents."); + } else + // Not catching this could lead to out of bounds errors later + // e.g. using my_mdspan_t = mdspan>; my_mdspan_t = m(new int[N], span(&N)); + // Right-hand-side construction looks ok with allocation and size matchgin, + // but since (potentially elsewhere defined) my_mdspan_t has static size m now things its range is 10 not N + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + static_cast<_TDynamic>(__vals[__i]) == static_cast<_TDynamic>(__static_val), + "extents construction: mismatch of provided arguments with static extents."); } } @@ -310,8 +316,10 @@ (sizeof...(_OtherIndexTypes) == __rank_ || sizeof...(_OtherIndexTypes) == __rank_dynamic_)) _LIBCPP_HIDE_FROM_ABI constexpr explicit extents(_OtherIndexTypes... __dynvals) noexcept : __vals_(static_cast(__dynvals)...) { - _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__are_representable_as(__dynvals...), - "extents ctor: arguments must be representable as index_type and nonnegative"); + // Not catching this could lead to out of bounds errors later + // e.g. mdspan m(ptr, dextents(200u)); leads to an extent of -56 on m + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__are_representable_as(__dynvals...), + "extents ctor: arguments must be representable as index_type and nonnegative"); } template @@ -321,8 +329,10 @@ explicit(_Size != __rank_dynamic_) _LIBCPP_HIDE_FROM_ABI constexpr extents(const array<_OtherIndexType, _Size>& __exts) noexcept : __vals_(span(__exts)) { - _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__are_representable_as(span(__exts)), - "extents ctor: arguments must be representable as index_type and nonnegative"); + // Not catching this could lead to out of bounds errors later + // e.g. mdspan m(ptr, dextents(array(200))); leads to an extent of -56 on m + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__are_representable_as(span(__exts)), + "extents ctor: arguments must be representable as index_type and nonnegative"); } template @@ -332,8 +342,11 @@ explicit(_Size != __rank_dynamic_) _LIBCPP_HIDE_FROM_ABI constexpr extents(const span<_OtherIndexType, _Size>& __exts) noexcept : __vals_(__exts) { - _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__are_representable_as(__exts), - "extents ctor: arguments must be representable as index_type and nonnegative"); + // Not catching this could lead to out of bounds errors later + // e.g. array a{200u}; mdspan> m(ptr, extents(span(a))); leads to an extent of -56 + // on m + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__are_representable_as(__exts), + "extents ctor: arguments must be representable as index_type and nonnegative"); } private: @@ -382,10 +395,16 @@ for (size_t __r = 0; __r < rank(); __r++) { if constexpr (static_cast>(numeric_limits::max()) < static_cast>(numeric_limits<_OtherIndexType>::max())) { - _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__is_representable_as(__other.extent(__r)), - "extents ctor: arguments must be representable as index_type and nonnegative"); + // Not catching this could lead to out of bounds errors later + // e.g. dextents> e(dextents(200)) leads to an extent of -56 on e + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + __mdspan_detail::__is_representable_as(__other.extent(__r)), + "extents ctor: arguments must be representable as index_type and nonnegative"); } - _LIBCPP_ASSERT_UNCATEGORIZED( + // Not catching this could lead to out of bounds errors later + // e.g. mdspan> m = mdspan>(new int[5], 5); + // Right-hand-side construction was ok, but m now things its range is 10 not 5 + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( (_Values::__static_value(__r) == dynamic_extent) || (static_cast(__other.extent(__r)) == static_cast(_Values::__static_value(__r))), "extents construction: mismatch of provided arguments with static extents."); diff --git a/libcxx/include/__mdspan/layout_left.h b/libcxx/include/__mdspan/layout_left.h --- a/libcxx/include/__mdspan/layout_left.h +++ b/libcxx/include/__mdspan/layout_left.h @@ -75,7 +75,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr mapping() noexcept = default; _LIBCPP_HIDE_FROM_ABI constexpr mapping(const mapping&) noexcept = default; _LIBCPP_HIDE_FROM_ABI constexpr mapping(const extents_type& __ext) noexcept : __extents_(__ext) { - _LIBCPP_ASSERT_UNCATEGORIZED( + // not catching this could lead to out-of-bounds access later when used inside mdspan + // mapping> map(dextents(40,40)); map(10, 3) == -126 + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __required_span_size_is_representable(__ext), "layout_left::mapping extents ctor: product of extents must be representable as index_type."); } @@ -85,7 +87,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherExtents, extents_type>) mapping(const mapping<_OtherExtents>& __other) noexcept : __extents_(__other.extents()) { - _LIBCPP_ASSERT_UNCATEGORIZED( + // not catching this could lead to out-of-bounds access later when used inside mdspan + // mapping> map(mapping>(dextents(40,40))); map(10, 3) == -126 + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __mdspan_detail::__is_representable_as(__other.required_span_size()), "layout_left::mapping converting ctor: other.required_span_size() must be representable as index_type."); } @@ -95,7 +99,13 @@ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherExtents, extents_type>) mapping(const layout_right::mapping<_OtherExtents>& __other) noexcept : __extents_(__other.extents()) { - _LIBCPP_ASSERT_UNCATEGORIZED( + // not catching this could lead to out-of-bounds access later when used inside mdspan + // Note: since this is constraint to rank 1: extents itself would catch the invalid conversion first + // and thus this assertion should never be triggered, but keeping it here for consistency + // layout_left::mapping> map( + // layout_right::mapping>(dextents(200))); map.extents().extent(0) == + // -56 + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __mdspan_detail::__is_representable_as(__other.required_span_size()), "layout_left::mapping converting ctor: other.required_span_size() must be representable as index_type."); } @@ -123,8 +133,11 @@ requires((sizeof...(_Indices) == extents_type::rank()) && (is_convertible_v<_Indices, index_type> && ...) && (is_nothrow_constructible_v && ...)) _LIBCPP_HIDE_FROM_ABI constexpr index_type operator()(_Indices... __idx) const noexcept { - _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__is_multidimensional_index_in(__extents_, __idx...), - "layout_left::mapping: out of bounds indexing"); + // Mappings are generally meant to be used for accessing allocations and are meant to guarantee to never + // return a value exceeding required_span_size(), which is used to know how large an allocation one needs + // Thus, this is a canonical point in multi-dimensional data structures to make invalid element access checks + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__is_multidimensional_index_in(__extents_, __idx...), + "layout_left::mapping: out of bounds indexing"); array __idx_a{static_cast(__idx)...}; return [&](index_sequence<_Pos...>) { index_type __res = 0; @@ -145,7 +158,10 @@ _LIBCPP_HIDE_FROM_ABI constexpr index_type stride(rank_type __r) const noexcept requires(extents_type::rank() > 0) { - _LIBCPP_ASSERT_UNCATEGORIZED(__r < extents_type::rank(), "layout_left::mapping::stride(): invalid rank index"); + // While it would be caught by extents itself too, using a too large __r + // is functionally an out of bounds access on the stored information needed to compute strides + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + __r < extents_type::rank(), "layout_left::mapping::stride(): invalid rank index"); index_type __s = 1; for (rank_type __i = extents_type::rank() - 1; __i > __r; __i--) __s *= __extents_.extent(__i); diff --git a/libcxx/include/__mdspan/layout_right.h b/libcxx/include/__mdspan/layout_right.h --- a/libcxx/include/__mdspan/layout_right.h +++ b/libcxx/include/__mdspan/layout_right.h @@ -74,7 +74,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr mapping() noexcept = default; _LIBCPP_HIDE_FROM_ABI constexpr mapping(const mapping&) noexcept = default; _LIBCPP_HIDE_FROM_ABI constexpr mapping(const extents_type& __ext) noexcept : __extents_(__ext) { - _LIBCPP_ASSERT_UNCATEGORIZED( + // not catching this could lead to out-of-bounds access later when used inside mdspan + // mapping> map(dextents(40,40)); map(3, 10) == -126 + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __required_span_size_is_representable(__ext), "layout_right::mapping extents ctor: product of extents must be representable as index_type."); } @@ -84,7 +86,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherExtents, extents_type>) mapping(const mapping<_OtherExtents>& __other) noexcept : __extents_(__other.extents()) { - _LIBCPP_ASSERT_UNCATEGORIZED( + // not catching this could lead to out-of-bounds access later when used inside mdspan + // mapping> map(mapping>(dextents(40,40))); map(3, 10) == -126 + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __mdspan_detail::__is_representable_as(__other.required_span_size()), "layout_right::mapping converting ctor: other.required_span_size() must be representable as index_type."); } @@ -94,7 +98,13 @@ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!is_convertible_v<_OtherExtents, extents_type>) mapping(const layout_left::mapping<_OtherExtents>& __other) noexcept : __extents_(__other.extents()) { - _LIBCPP_ASSERT_UNCATEGORIZED( + // not catching this could lead to out-of-bounds access later when used inside mdspan + // Note: since this is constraint to rank 1: extents itself would catch the invalid conversion first + // and thus this assertion should never be triggered, but keeping it here for consistency + // layout_right::mapping> map( + // layout_left::mapping>(dextents(200))); map.extents().extent(0) == + // -56 + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( __mdspan_detail::__is_representable_as(__other.required_span_size()), "layout_right::mapping converting ctor: other.required_span_size() must be representable as index_type."); } @@ -122,8 +132,11 @@ requires((sizeof...(_Indices) == extents_type::rank()) && (is_convertible_v<_Indices, index_type> && ...) && (is_nothrow_constructible_v && ...)) _LIBCPP_HIDE_FROM_ABI constexpr index_type operator()(_Indices... __idx) const noexcept { - _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__is_multidimensional_index_in(__extents_, __idx...), - "layout_right::mapping: out of bounds indexing"); + // Mappings are generally meant to be used for accessing allocations and are meant to guarantee to never + // return a value exceeding required_span_size(), which is used to know how large an allocation one needs + // Thus, this is a canonical point in multi-dimensional data structures to make invalid element access checks + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__is_multidimensional_index_in(__extents_, __idx...), + "layout_right::mapping: out of bounds indexing"); return [&](index_sequence<_Pos...>) { index_type __res = 0; ((__res = static_cast(__idx) + __extents_.extent(_Pos) * __res), ...); @@ -142,7 +155,10 @@ _LIBCPP_HIDE_FROM_ABI constexpr index_type stride(rank_type __r) const noexcept requires(extents_type::rank() > 0) { - _LIBCPP_ASSERT_UNCATEGORIZED(__r < extents_type::rank(), "layout_right::mapping::stride(): invalid rank index"); + // While it would be caught by extents itself too, using a too large __r + // is functionally an out of bounds access on the stored information needed to compute strides + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( + __r < extents_type::rank(), "layout_right::mapping::stride(): invalid rank index"); index_type __s = 1; for (rank_type __i = extents_type::rank() - 1; __i > __r; __i--) __s *= __extents_.extent(__i); diff --git a/libcxx/include/__mdspan/mdspan.h b/libcxx/include/__mdspan/mdspan.h --- a/libcxx/include/__mdspan/mdspan.h +++ b/libcxx/include/__mdspan/mdspan.h @@ -166,7 +166,10 @@ // always construct its extents() only from the dynamic extents, instead of from the other extents. if constexpr (rank() > 0) { for (size_t __r = 0; __r < rank(); __r++) { - _LIBCPP_ASSERT_UNCATEGORIZED( + // Not catching this could lead to out of bounds errors later + // e.g. mdspan, non_checking_layout> m = + // mdspan, non_checking_layout>(ptr, 200); leads to an extent of -56 on m + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS( (static_extent(__r) == dynamic_extent) || (static_cast(__other.extent(__r)) == static_cast(static_extent(__r))), "mdspan: conversion mismatch of source dynamic extents with static extents"); @@ -185,8 +188,10 @@ (is_nothrow_constructible_v && ...) && (sizeof...(_OtherIndexTypes) == rank())) _LIBCPP_HIDE_FROM_ABI constexpr reference operator[](_OtherIndexTypes... __indices) const { - _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__is_multidimensional_index_in(extents(), __indices...), - "mdspan: operator[] out of bounds access"); + // Note the standard layouts would also check this, but user provided ones may not, so we + // check the precondition here + _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__mdspan_detail::__is_multidimensional_index_in(extents(), __indices...), + "mdspan: operator[] out of bounds access"); return __acc_.access(__ptr_, __map_(static_cast(std::move(__indices))...)); } @@ -209,6 +214,8 @@ } _LIBCPP_HIDE_FROM_ABI constexpr size_type size() const noexcept { + // Could leave this as only checked in debug mode: semantically size() is never + // guaranteed to be related to any accessible range _LIBCPP_ASSERT_UNCATEGORIZED( false == ([&](index_sequence<_Idxs...>) { size_type __prod = 1; diff --git a/libcxx/test/std/containers/views/mdspan/extents/assert.conversion.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.conversion.pass.cpp rename from libcxx/test/std/containers/views/mdspan/extents/assert.conversion.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/extents/assert.conversion.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/extents/assert.conversion.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.conversion.pass.cpp @@ -6,7 +6,7 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp rename from libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_array.pass.cpp @@ -6,7 +6,7 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp rename from libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_integral.pass.cpp @@ -6,7 +6,7 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp rename from libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.ctor_from_span.pass.cpp @@ -6,7 +6,7 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // Test construction from span: diff --git a/libcxx/test/std/containers/views/mdspan/extents/assert.obs.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.obs.pass.cpp rename from libcxx/test/std/containers/views/mdspan/extents/assert.obs.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/extents/assert.obs.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/extents/assert.obs.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/extents/assert.obs.pass.cpp @@ -6,7 +6,7 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/assert.conversion.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.conversion.pass.cpp rename from libcxx/test/std/containers/views/mdspan/layout_left/assert.conversion.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.conversion.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_left/assert.conversion.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.conversion.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp rename from libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.extents.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp rename from libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.ctor.layout_right.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp rename from libcxx/test/std/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.index_operator.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/layout_left/assert.stride.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp rename from libcxx/test/std/containers/views/mdspan/layout_left/assert.stride.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_left/assert.stride.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/assert.conversion.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.conversion.pass.cpp rename from libcxx/test/std/containers/views/mdspan/layout_right/assert.conversion.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.conversion.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_right/assert.conversion.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.conversion.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp rename from libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.extents.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp rename from libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.ctor.layout_left.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp rename from libcxx/test/std/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.index_operator.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/layout_right/assert.stride.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp rename from libcxx/test/std/containers/views/mdspan/layout_right/assert.stride.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/layout_right/assert.stride.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/assert.conversion.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.conversion.pass.cpp rename from libcxx/test/std/containers/views/mdspan/mdspan/assert.conversion.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.conversion.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/mdspan/assert.conversion.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.conversion.pass.cpp @@ -6,7 +6,7 @@ //===----------------------------------------------------------------------===// // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // @@ -42,7 +42,7 @@ #include #include "check_assertion.h" -#include "CustomTestLayouts.h" +#include "../../../../../std/containers/views/mdspan/mdspan/CustomTestLayouts.h" // We use a funky mapping in this test that doesn't check the dynamic/static extents mismatch itself int main(int, char**) { diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp rename from libcxx/test/std/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.index_operator.pass.cpp @@ -8,7 +8,7 @@ // REQUIRES: has-unix-headers // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 -// UNSUPPORTED: !libcpp-has-debug-mode +// UNSUPPORTED: !libcpp-has-hardened-mode && !libcpp-has-debug-mode // XFAIL: availability-verbose_abort-missing // diff --git a/libcxx/test/std/containers/views/mdspan/mdspan/assert.size.pass.cpp b/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.size.pass.cpp rename from libcxx/test/std/containers/views/mdspan/mdspan/assert.size.pass.cpp rename to libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.size.pass.cpp --- a/libcxx/test/std/containers/views/mdspan/mdspan/assert.size.pass.cpp +++ b/libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.size.pass.cpp @@ -22,7 +22,7 @@ #include #include "check_assertion.h" -#include "CustomTestLayouts.h" +#include "../../../../../std/containers/views/mdspan/mdspan/CustomTestLayouts.h" // We use a funky mapping in this test where required_span_size is much smaller than the size of the index space int main(int, char**) {