From 1be41ad752945b0ed5c26aa134a30c145a29afd0 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 2 Feb 2026 13:10:50 +0000 Subject: [PATCH] libstdc++: Fix some -Wpedantic warnings in regex tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These tests can be run as C++11, so should use a string literal with the static assertions. libstdc++-v3/ChangeLog: * testsuite/28_regex/algorithms/regex_match/multiline.cc: Add string to static_assert. * testsuite/28_regex/sub_match/lwg3204.cc: Likewise. Reviewed-by: Tomasz KamiƄski --- .../testsuite/28_regex/algorithms/regex_match/multiline.cc | 4 ++-- libstdc++-v3/testsuite/28_regex/sub_match/lwg3204.cc | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/multiline.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/multiline.cc index f4b3cf03a22..090fd0955cc 100644 --- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/multiline.cc +++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/multiline.cc @@ -3,8 +3,8 @@ #include #if __cplusplus >= 201703L || !defined __STRICT_ANSI__ -static_assert( std::regex_constants::multiline == std::regex::multiline ); -static_assert( std::regex_constants::__multiline == std::regex::multiline ); +static_assert( std::regex_constants::multiline == std::regex::multiline, "" ); +static_assert( std::regex_constants::__multiline == std::regex::multiline, "" ); #else namespace test { constexpr int multiline = 0; } namespace check { diff --git a/libstdc++-v3/testsuite/28_regex/sub_match/lwg3204.cc b/libstdc++-v3/testsuite/28_regex/sub_match/lwg3204.cc index 58ef0df58a1..d95aed36787 100644 --- a/libstdc++-v3/testsuite/28_regex/sub_match/lwg3204.cc +++ b/libstdc++-v3/testsuite/28_regex/sub_match/lwg3204.cc @@ -33,6 +33,8 @@ struct iter }; using CS = std::csub_match; -static_assert( noexcept(std::declval().swap(std::declval())) ); +static_assert( noexcept(std::declval().swap(std::declval())), + "std::csub_match::swap is nothrow" ); using IS = std::sub_match; -static_assert( ! noexcept(std::declval().swap(std::declval())) ); +static_assert( ! noexcept(std::declval().swap(std::declval())), + "std::sub_match::swap is potentially throwing" );