[gcc r16-7320] libstdc++: Fix some -Wpedantic warnings in regex tests
Jonathan Wakely
redi@gcc.gnu.org
Thu Feb 5 11:53:19 GMT 2026
https://gcc.gnu.org/g:1be41ad752945b0ed5c26aa134a30c145a29afd0
commit r16-7320-g1be41ad752945b0ed5c26aa134a30c145a29afd0
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Feb 2 13:10:50 2026 +0000
libstdc++: Fix some -Wpedantic warnings in regex tests
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 <tkaminsk@redhat.com>
Diff:
---
libstdc++-v3/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 f4b3cf03a225..090fd0955cc8 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 <testsuite_hooks.h>
#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 58ef0df58a14..d95aed367876 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<CS&>().swap(std::declval<CS&>())) );
+static_assert( noexcept(std::declval<CS&>().swap(std::declval<CS&>())),
+ "std::csub_match::swap is nothrow" );
using IS = std::sub_match<iter>;
-static_assert( ! noexcept(std::declval<IS&>().swap(std::declval<IS&>())) );
+static_assert( ! noexcept(std::declval<IS&>().swap(std::declval<IS&>())),
+ "std::sub_match<I>::swap is potentially throwing" );
More information about the Libstdc++-cvs
mailing list