On Mon, 16 Feb 2026 at 12:36, Tomasz Kamiński <[email protected]> wrote:
>
> This patch implements LWG 4491, addressing C++26 NB comments.
>
> libstdc++-v3/ChangeLog:
>
>         * include/std/mdspan (std::submdspan_extents): Rename to...
>         (std::subextents): Rename of submdspan_extents.
>         (std::submdspan_canonicalize_slices): Rename to...
>         (std::canonical_slices):
>         * 
> testsuite/23_containers/mdspan/submdspan/submdspan_canonicalize_slices.cc:
>         Move to...
>         * testsuite/23_containers/mdspan/submdspan/canonical_slices.cc: 
> ...here.
>         Updated calls to submdspan_canonicalize_slices.
>         * 
> testsuite/23_containers/mdspan/submdspan/submdspan_canonicalize_slices_neg.cc:
>         Move to...
>         * testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc: 
> ...here.
>         Updated calls to submdspan_canonicalize_slices.
>         * testsuite/23_containers/mdspan/submdspan/submdspan_extents.cc: Move 
> to...
>         * testsuite/23_containers/mdspan/submdspan/subextents.cc: ...here.
>         Qualified and renamed calls to submdspan_extents.
>         * testsuite/23_containers/mdspan/submdspan/submdspan_extents_neg.cc: 
> Move to...
>         * testsuite/23_containers/mdspan/submdspan/subextents_neg.cc: ...here.
>         Qualified and renamed calls to submdspan_extents.
> ---
> I haven't added _GLIBCXX_RESOLVE_ISSUE comments, as it is trivial
> to check if the functions were renamed.

Also this isn't a defect in a published standard, the renaming is just
changing something that was in a C++2c draft.

I think it's more important/useful to use RESOLVE_LIB_DEFECTS comments
when what we implement is different from the published standard. But
when it's just a difference between one draft and another draft, we
can just ship the change without a comment to record it.

OK for trunk

>
> Testing on x86_64-linux. All *mdspan* test already passed in all
> supported standards.
>
>  libstdc++-v3/include/std/mdspan               |  8 +++----
>  ...nicalize_slices.cc => canonical_slices.cc} | 24 +++++++++----------
>  ..._slices_neg.cc => canonical_slices_neg.cc} | 16 ++++++-------
>  .../{submdspan_extents.cc => subextents.cc}   | 18 +++++++-------
>  ...dspan_extents_neg.cc => subextents_neg.cc} |  6 ++---
>  5 files changed, 36 insertions(+), 36 deletions(-)
>  rename 
> libstdc++-v3/testsuite/23_containers/mdspan/submdspan/{submdspan_canonicalize_slices.cc
>  => canonical_slices.cc} (87%)
>  rename 
> libstdc++-v3/testsuite/23_containers/mdspan/submdspan/{submdspan_canonicalize_slices_neg.cc
>  => canonical_slices_neg.cc} (95%)
>  rename 
> libstdc++-v3/testsuite/23_containers/mdspan/submdspan/{submdspan_extents.cc 
> => subextents.cc} (88%)
>  rename 
> libstdc++-v3/testsuite/23_containers/mdspan/submdspan/{submdspan_extents_neg.cc
>  => subextents_neg.cc} (85%)
>
> diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan
> index cedf597d3c2..0c89f8e7155 100644
> --- a/libstdc++-v3/include/std/mdspan
> +++ b/libstdc++-v3/include/std/mdspan
> @@ -3348,8 +3348,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>    template<typename _IndexType, size_t... _Extents, typename... _RawSlices>
>      requires (sizeof...(_RawSlices) == sizeof...(_Extents))
>      constexpr auto
> -    submdspan_extents(const extents<_IndexType, _Extents...>& __exts,
> -                     _RawSlices... __raw_slices)
> +    subextents(const extents<_IndexType, _Extents...>& __exts,
> +              _RawSlices... __raw_slices)
>      {
>        auto __impl = [&__exts](auto... __slices)
>        {
> @@ -3362,8 +3362,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>    template<typename _IndexType, size_t... _Extents, typename... _RawSlices>
>      requires (sizeof...(_Extents) == sizeof...(_RawSlices))
>      constexpr auto
> -    submdspan_canonicalize_slices(const extents<_IndexType, _Extents...>& 
> __exts,
> -                                 _RawSlices... __raw_slices)
> +    canonical_slices(const extents<_IndexType, _Extents...>& __exts,
> +                    _RawSlices... __raw_slices)
>      {
>        auto __impl = [&__exts](auto... __slices)
>        {
> diff --git 
> a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_canonicalize_slices.cc
>  b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices.cc
> similarity index 87%
> rename from 
> libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_canonicalize_slices.cc
> rename to 
> libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices.cc
> index 077bafc2a9b..5ca123eee50 100644
> --- 
> a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_canonicalize_slices.cc
> +++ 
> b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices.cc
> @@ -13,11 +13,11 @@ template<typename Extents, typename CInt>
>    {
>      using IndexType = typename Extents::index_type;
>      auto ci_expected = std::cw<IndexType{ci_raw.value}>;
> -    auto [ci] = std::submdspan_canonicalize_slices(exts, ci_raw);
> +    auto [ci] = std::canonical_slices(exts, ci_raw);
>      static_assert(std::same_as<decltype(ci), decltype(ci_expected)>);
>      VERIFY(std::cmp_equal(ci.value, ci_raw.value));
>
> -    auto [i] = std::submdspan_canonicalize_slices(exts, ci_raw.value);
> +    auto [i] = std::canonical_slices(exts, ci_raw.value);
>      static_assert(std::same_as<decltype(i), IndexType>);
>      VERIFY(std::cmp_equal(i, ci_raw.value));
>      return true;
> @@ -62,25 +62,25 @@ template<template<typename, typename> typename Pair>
>      auto c1 = std::cw<IndexType{1}>;
>
>      auto raw_cc = Pair{cbegin, cend};
> -    auto [cc] = std::submdspan_canonicalize_slices(exts, raw_cc);
> +    auto [cc] = std::canonical_slices(exts, raw_cc);
>      assert_same(cc.offset, coffset);
>      assert_same(cc.extent, cextent);
>      assert_same(cc.stride, c1);
>
>      auto raw_cd = Pair{cbegin, cend.value};
> -    auto [cd] = std::submdspan_canonicalize_slices(exts, raw_cd);
> +    auto [cd] = std::canonical_slices(exts, raw_cd);
>      assert_same(cd.offset, coffset);
>      assert_same(cd.extent, cextent.value);
>      assert_same(cd.stride, c1);
>
>      auto raw_dc = Pair{cbegin.value, cend};
> -    auto [dc] = std::submdspan_canonicalize_slices(exts, raw_dc);
> +    auto [dc] = std::canonical_slices(exts, raw_dc);
>      assert_same(dc.offset, coffset.value);
>      assert_same(dc.extent, cextent.value);
>      assert_same(dc.stride, c1);
>
>      auto raw_dd = Pair{cbegin.value, cend.value};
> -    auto [dd] = std::submdspan_canonicalize_slices(exts, raw_dd);
> +    auto [dd] = std::canonical_slices(exts, raw_dd);
>      assert_same(dd.offset, coffset.value);
>      assert_same(dd.extent, cextent.value);
>      assert_same(dd.stride, c1);
> @@ -128,25 +128,25 @@ test_strided_slice(auto exts, auto co, auto ce, auto cs)
>    auto cstride = std::cw<IndexType{cs.value}>;
>
>    auto raw_ccc = std::strided_slice{co, ce, cs};
> -  auto [ccc] = std::submdspan_canonicalize_slices(exts, raw_ccc);
> +  auto [ccc] = std::canonical_slices(exts, raw_ccc);
>    assert_same(ccc.offset, coffset);
>    assert_same(ccc.extent, cextent);
>    assert_same(ccc.stride, cstride);
>
>    auto raw_dcc = std::strided_slice{co.value, ce, cs};
> -  auto [dcc] = std::submdspan_canonicalize_slices(exts, raw_dcc);
> +  auto [dcc] = std::canonical_slices(exts, raw_dcc);
>    assert_same(dcc.offset, coffset.value);
>    assert_same(dcc.extent, cextent);
>    assert_same(dcc.stride, cstride);
>
>    auto raw_cdc = std::strided_slice{co, ce.value, cs};
> -  auto [cdc] = std::submdspan_canonicalize_slices(exts, raw_cdc);
> +  auto [cdc] = std::canonical_slices(exts, raw_cdc);
>    assert_same(cdc.offset, coffset);
>    assert_same(cdc.extent, cextent.value);
>    assert_same(cdc.stride, cstride);
>
>    auto raw_ccd = std::strided_slice{co, ce, cs.value};
> -  auto [ccd] = std::submdspan_canonicalize_slices(exts, raw_ccd);
> +  auto [ccd] = std::canonical_slices(exts, raw_ccd);
>    assert_same(ccd.offset, coffset);
>    assert_same(ccd.extent, cextent);
>    assert_same(ccd.stride, cstride.value);
> @@ -174,11 +174,11 @@ test_strided_slice_zero_extent(auto exts, auto cs)
>    using IndexType = typename decltype(exts)::index_type;
>    auto c0 = std::cw<uint8_t{0}>;
>    auto raw_ccc = std::strided_slice{c0, c0, cs};
> -  auto [ccc] = std::submdspan_canonicalize_slices(exts, raw_ccc);
> +  auto [ccc] = std::canonical_slices(exts, raw_ccc);
>    assert_same(ccc.stride, std::cw<IndexType{1}>);
>
>    auto raw_ccd = std::strided_slice{c0, c0, cs.value};
> -  auto [ccd] = std::submdspan_canonicalize_slices(exts, raw_ccd);
> +  auto [ccd] = std::canonical_slices(exts, raw_ccd);
>    assert_same(ccd.stride, std::cw<IndexType{1}>);
>    return true;
>  }
> diff --git 
> a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_canonicalize_slices_neg.cc
>  
> b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc
> similarity index 95%
> rename from 
> libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_canonicalize_slices_neg.cc
> rename to 
> libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc
> index 94bca183aa3..6dbfd5e8a1b 100644
> --- 
> a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_canonicalize_slices_neg.cc
> +++ 
> b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc
> @@ -17,7 +17,7 @@ constexpr bool
>  test_rank_mismatch()
>  {
>    auto exts = std::extents(1);
> -  std::submdspan_canonicalize_slices(exts, 0, 0); // { dg-error "no 
> matching" }
> +  std::canonical_slices(exts, 0, 0); // { dg-error "no matching" }
>    return true;
>  }
>
> @@ -25,7 +25,7 @@ template<typename Int, typename Extents>
>  constexpr bool
>  test_under1(Int i1, Extents exts)
>  {
> -  auto [s1] = std::submdspan_canonicalize_slices(exts, i1);
> +  auto [s1] = std::canonical_slices(exts, i1);
>    return true;
>  }
>
> @@ -43,7 +43,7 @@ template<typename Int, typename Extents>
>  constexpr bool
>  test_over1(Int i1, Extents exts)
>  {
> -  auto [s1] = std::submdspan_canonicalize_slices(exts, i1);
> +  auto [s1] = std::canonical_slices(exts, i1);
>    return true;
>  }
>
> @@ -65,7 +65,7 @@ template<typename Offset, typename Extent, typename Stride, 
> typename Extents>
>    constexpr bool
>    test_under2(Offset o, Extent e, Stride s, Extents exts)
>    {
> -    std::submdspan_canonicalize_slices(exts, std::strided_slice{o, e, s});
> +    std::canonical_slices(exts, std::strided_slice{o, e, s});
>      return true;
>    }
>
> @@ -105,7 +105,7 @@ template<typename Offset, typename Extent, typename 
> Stride, typename Extents>
>    constexpr bool
>    test_over2(Offset o, Extent e, Stride s, Extents exts)
>    {
> -    std::submdspan_canonicalize_slices(exts, std::strided_slice{o, e, s});
> +    std::canonical_slices(exts, std::strided_slice{o, e, s});
>      return true;
>    }
>
> @@ -157,7 +157,7 @@ test_overflow1(auto o, auto e)
>  {
>    auto exts = std::extents<uint8_t, dyn>{255};
>    auto slice = std::strided_slice{o, e, 1};
> -  std::submdspan_canonicalize_slices(exts, slice);
> +  std::canonical_slices(exts, slice);
>    return true;
>  }
>
> @@ -171,7 +171,7 @@ test_overflow2(auto b, auto e)
>  {
>    auto exts = std::extents<uint8_t, dyn>{255};
>    auto slice = std::pair{b, e};
> -  std::submdspan_canonicalize_slices(exts, slice);
> +  std::canonical_slices(exts, slice);
>    return true;
>  }
>
> @@ -192,7 +192,7 @@ test_invalid(auto e, auto s)
>  {
>    auto exts = std::extents(5);
>    auto slice = std::strided_slice(0, e, s);
> -  std::submdspan_canonicalize_slices(exts, slice);
> +  std::canonical_slices(exts, slice);
>    return true;
>  }
>
> diff --git 
> a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_extents.cc 
> b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents.cc
> similarity index 88%
> rename from 
> libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_extents.cc
> rename to libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents.cc
> index 841910a77c8..ae77d3d96a8 100644
> --- 
> a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_extents.cc
> +++ b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents.cc
> @@ -11,7 +11,7 @@ constexpr bool
>  test_from_full_extent()
>  {
>    auto exts = std::extents<int, 3, dyn, 7>{};
> -  auto sub_exts = submdspan_extents(exts, 1, all, all);
> +  auto sub_exts = std::subextents(exts, 1, all, all);
>    VERIFY(sub_exts.rank() == 2);
>    VERIFY(sub_exts.static_extent(0) == dyn);
>    VERIFY(sub_exts.extent(0) == exts.extent(1));
> @@ -27,7 +27,7 @@ template<template<typename, typename> typename Pair, 
> template<int> typename Cw>
>      auto s0 = Cw<1>{};
>      auto s1 = Pair{Cw<1>{}, Cw<2>{}};
>      auto s2 = Pair{Cw<1>{}, 4};
> -    auto sub_exts = submdspan_extents(exts, s0, s1, s2);
> +    auto sub_exts = std::subextents(exts, s0, s1, s2);
>      VERIFY(sub_exts.rank() == 2);
>      VERIFY(sub_exts.static_extent(0) == size_t(get<1>(s1) - get<0>(s1)));
>      VERIFY(sub_exts.static_extent(1) == dyn);
> @@ -50,7 +50,7 @@ template<typename Int>
>    test_from_int_like_as_scalar()
>    {
>      auto exts = std::extents<int, 3, 5>{};
> -    auto sub_exts = submdspan_extents(exts, Int(1), std::tuple{1, 3});
> +    auto sub_exts = std::subextents(exts, Int(1), std::tuple{1, 3});
>      VERIFY(sub_exts.rank() == 1);
>      VERIFY(sub_exts.static_extent(0) == dyn);
>      VERIFY(sub_exts.extent(0) == 2);
> @@ -61,7 +61,7 @@ template<template<int> typename Cw>
>    test_from_const_int()
>    {
>      auto exts = std::extents<int, 3, 5>{};
> -    auto sub_exts = submdspan_extents(exts, Cw<1>{}, std::tuple{1, 3});
> +    auto sub_exts = std::subextents(exts, Cw<1>{}, std::tuple{1, 3});
>      VERIFY(sub_exts.rank() == 1);
>      VERIFY(sub_exts.static_extent(0) == dyn);
>      VERIFY(sub_exts.extent(0) == 2);
> @@ -73,7 +73,7 @@ template<typename Int>
>    test_from_int_like_in_tuple()
>    {
>      auto exts = std::extents<int, 3, 5>{};
> -    auto sub_exts = submdspan_extents(exts, Int(1), std::tuple{Int(1), 
> Int(3)});
> +    auto sub_exts = std::subextents(exts, Int(1), std::tuple{Int(1), 
> Int(3)});
>      VERIFY(sub_exts.rank() == 1);
>      VERIFY(sub_exts.static_extent(0) == dyn);
>      VERIFY(sub_exts.extent(0) == 2);
> @@ -89,7 +89,7 @@ template<template<int> typename Cw>
>        auto s0 = 1;
>        auto s1 = std::strided_slice{0, 0, 0};
>        auto s2 = std::strided_slice{1, Cw<0>{}, 0};
> -      auto sub_exts = submdspan_extents(exts, s0, s1, s2);
> +      auto sub_exts = std::subextents(exts, s0, s1, s2);
>        VERIFY(sub_exts.rank() == 2);
>        VERIFY(sub_exts.static_extent(0) == dyn);
>        VERIFY(sub_exts.extent(0) == 0);
> @@ -100,7 +100,7 @@ template<template<int> typename Cw>
>        auto s0 = 1;
>        auto s1 = std::strided_slice{0, 2, Cw<1>{}};
>        auto s2 = std::strided_slice{1, Cw<2>{}, 1};
> -      auto sub_exts = submdspan_extents(exts, s0, s1, s2);
> +      auto sub_exts = std::subextents(exts, s0, s1, s2);
>        VERIFY(sub_exts.rank() == 2);
>        VERIFY(sub_exts.static_extent(0) == dyn);
>        VERIFY(sub_exts.extent(0) == 2);
> @@ -113,7 +113,7 @@ template<template<int> typename Cw>
>        auto s0 = 1;
>        auto s1 = std::strided_slice{1, Cw<4>{}, 2};
>        auto s2 = std::strided_slice{1, Cw<10>{}, Cw<3>{}};
> -      auto sub_exts = submdspan_extents(exts, s0, s1, s2);
> +      auto sub_exts = std::subextents(exts, s0, s1, s2);
>        VERIFY(sub_exts.rank() == 2);
>        VERIFY(sub_exts.static_extent(0) == dyn);
>        VERIFY(sub_exts.extent(0) == 2);
> @@ -125,7 +125,7 @@ template<template<int> typename Cw>
>        auto s0 = std::strided_slice(0, 3, 2);
>        auto s1 = std::strided_slice(1, 4, 2);
>        auto s2 = std::strided_slice(0, 7, 3);
> -      auto sub_exts = submdspan_extents(exts, s0, s1, s2);
> +      auto sub_exts = std::subextents(exts, s0, s1, s2);
>        VERIFY(sub_exts.rank() == 3);
>        VERIFY(sub_exts.extent(0) == 2);
>        VERIFY(sub_exts.extent(1) == 2);
> diff --git 
> a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_extents_neg.cc
>  b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents_neg.cc
> similarity index 85%
> rename from 
> libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_extents_neg.cc
> rename to 
> libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents_neg.cc
> index cf27c0c7e4d..c81a1383e3c 100644
> --- 
> a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/submdspan_extents_neg.cc
> +++ b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/subextents_neg.cc
> @@ -10,7 +10,7 @@ constexpr bool
>  test_unrelated_stride_type()
>  {
>    auto exts = std::extents(3, 5, 7);
> -  auto sub_exts = submdspan_extents(exts, 1, NotASlice{}, 2);  // { dg-error 
> "required from" }
> +  auto sub_exts = subextents(exts, 1, NotASlice{}, 2);  // { dg-error 
> "required from" }
>    return true;
>  }
>  static_assert(test_unrelated_stride_type());
> @@ -20,7 +20,7 @@ test_invalid_stride_zero()
>  {
>    auto exts = std::extents(3, 5, 7);
>    auto s = std::strided_slice{0, 1, 0};
> -  auto sub_exts = submdspan_extents(exts, 1, s, 2);  // { dg-error 
> "expansion of" }
> +  auto sub_exts = std::subextents(exts, 1, s, 2);  // { dg-error "expansion 
> of" }
>    return true;
>  }
>  static_assert(test_invalid_stride_zero());
> @@ -30,7 +30,7 @@ constexpr bool
>  test_out_of_bounds(const Slice& slice)
>  {
>    auto exts = std::extents<uint16_t, 3, 5, 7>{};
> -  auto sub_exts = submdspan_extents(exts, 1, slice, 2);  // { dg-error 
> "expansion of" }
> +  auto sub_exts = std::subextents(exts, 1, slice, 2);  // { dg-error 
> "expansion of" }
>    return true;
>  }
>  static_assert(test_out_of_bounds(std::strided_slice{0, 6, 1}));  // { 
> dg-error "expansion of" }
> --
> 2.53.0
>

Reply via email to