]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix some -Wpedantic warnings in regex tests
authorJonathan Wakely <jwakely@redhat.com>
Mon, 2 Feb 2026 13:10:50 +0000 (13:10 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 5 Feb 2026 11:45:56 +0000 (11:45 +0000)
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>
libstdc++-v3/testsuite/28_regex/algorithms/regex_match/multiline.cc
libstdc++-v3/testsuite/28_regex/sub_match/lwg3204.cc

index f4b3cf03a2250d55f7ed9aaaf63e33faac0a7ad0..090fd0955cc8b3c1ed19288558fe55d074251623 100644 (file)
@@ -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 {
index 58ef0df58a1409306eff0cc3e3b220886588a729..d95aed367876eaf186faf2bae7744b544947a8da 100644 (file)
@@ -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" );