[committed] libstdc++: Adjust checks for expected message for mdspan negative tests.

Tomasz Kamiński tkaminsk@redhat.com
Tue Aug 18 09:46:27 GMT 2026


The affected cases, corresponds to use of compile know extents, and
errors corresponds to static_assertion failures, that are triggered from
instantiation ("required from"), not during evaluation ("in expansion of").

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/mdspan/layouts/padded_neg.cc: Adjust
	message pattern for test cases using static extents.
	* testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc:
	Likewise.
---
I haven't investigated exact GCC commit that caused this diagnostic
change, as the output seem more correct to me now.

Tested affected test on x86_64-linux in all standard modes, debug,
and -m32 locally. Pushed to trunk.

 .../testsuite/23_containers/mdspan/layouts/padded_neg.cc  | 8 ++++----
 .../mdspan/submdspan/canonical_slices_neg.cc              | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded_neg.cc b/libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded_neg.cc
index 4073f683822..36d61179cf8 100644
--- a/libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/mdspan/layouts/padded_neg.cc
@@ -244,8 +244,8 @@ template<template<size_t> typename Layout>
     (void) m;
     return true;
   }
-static_assert(test_from_samepad_sta<std::layout_left_padded>()); // { dg-error "expansion of" }
-static_assert(test_from_samepad_sta<std::layout_right_padded>()); // { dg-error "expansion of" }
+static_assert(test_from_samepad_sta<std::layout_left_padded>()); // { dg-error "required from" }
+static_assert(test_from_samepad_sta<std::layout_right_padded>()); // { dg-error "required from" }
 
 template<template<size_t> typename Layout>
   constexpr bool
@@ -295,11 +295,11 @@ template<template<size_t> typename Layout, size_t RunId>
       }
     return true;
   }
-static_assert(test_to_same_not_exhaustive<std::layout_left_padded, 0>()); // { dg-error "expansion of" }
+static_assert(test_to_same_not_exhaustive<std::layout_left_padded, 0>()); // { dg-error "required from" }
 static_assert(test_to_same_not_exhaustive<std::layout_left_padded, 1>()); // { dg-error "expansion of" }
 static_assert(test_to_same_not_exhaustive<std::layout_left_padded, 2>()); // { dg-error "expansion of" }
 static_assert(test_to_same_not_exhaustive<std::layout_left_padded, 3>()); // { dg-error "expansion of" }
-static_assert(test_to_same_not_exhaustive<std::layout_right_padded, 0>()); // { dg-error "expansion of" }
+static_assert(test_to_same_not_exhaustive<std::layout_right_padded, 0>()); // { dg-error "required from" }
 static_assert(test_to_same_not_exhaustive<std::layout_right_padded, 1>()); // { dg-error "expansion of" }
 static_assert(test_to_same_not_exhaustive<std::layout_right_padded, 2>()); // { dg-error "expansion of" }
 static_assert(test_to_same_not_exhaustive<std::layout_right_padded, 3>()); // { dg-error "expansion of" }
diff --git a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc
index 5c61e938da5..c1ff4275cbd 100644
--- a/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/mdspan/submdspan/canonical_slices_neg.cc
@@ -55,11 +55,11 @@ static_assert(test_over1(5, sta_sexts));   // { dg-error "expansion of" }
 static_assert(test_over1(5, sta_uexts));   // { dg-error "expansion of" }
 
 static_assert(test_over1(std::cw<0>, dyn_empty));   // { dg-error "expansion of" }
-static_assert(test_over1(std::cw<0>, sta_empty));   // { dg-error "expansion of" }
+static_assert(test_over1(std::cw<0>, sta_empty));   // { dg-error "required from" }
 static_assert(test_over1(std::cw<5>, dyn_sexts));   // { dg-error "expansion of" }
 static_assert(test_over1(std::cw<5>, dyn_uexts));   // { dg-error "expansion of" }
-static_assert(test_over1(std::cw<5>, sta_sexts));   // { dg-error "expansion of" }
-static_assert(test_over1(std::cw<5>, sta_uexts));   // { dg-error "expansion of" }
+static_assert(test_over1(std::cw<5>, sta_sexts));   // { dg-error "required from" }
+static_assert(test_over1(std::cw<5>, sta_uexts));   // { dg-error "required from" }
 
 template<typename Offset, typename Extent, typename Stride, typename Extents>
   constexpr bool
-- 
2.55.0



More information about the Libstdc++ mailing list