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>
This commit is contained in:
Jonathan Wakely
2026-02-02 13:10:50 +00:00
committed by Jonathan Wakely
parent 9765a73075
commit 1be41ad752
2 changed files with 6 additions and 4 deletions

View 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 {

View 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" );