public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6257] libstdc++: Compare match_results for failed regex_match
@ 2022-01-05 13:47 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2022-01-05 13:47 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:9a2451c1013c21e76da89df89c3c8e5e6afe6154

commit r12-6257-g9a2451c1013c21e76da89df89c3c8e5e6afe6154
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Dec 17 17:58:09 2021 +0000

    libstdc++: Compare match_results for failed regex_match
    
    The regex_match_debug testsuite helper doesn't compare the
    std::match_results objects after a failed match, but it should do. The
    standard says that the effects of a failed match on the match-results
    are unspecified, except that [conditions testable by operator==]. So we
    can check that the two sets of results compare equal even if the match
    failed.
    
    libstdc++-v3/ChangeLog:
    
            * testsuite/util/testsuite_regex.h (regex_match_debug): Compare
            results even if the match failed.

Diff:
---
 libstdc++-v3/testsuite/util/testsuite_regex.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libstdc++-v3/testsuite/util/testsuite_regex.h b/libstdc++-v3/testsuite/util/testsuite_regex.h
index 6af3d8d836f..f2bb068024d 100644
--- a/libstdc++-v3/testsuite/util/testsuite_regex.h
+++ b/libstdc++-v3/testsuite/util/testsuite_regex.h
@@ -150,8 +150,7 @@ namespace __gnu_test
       auto __res2 = __regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
 	   _RegexExecutorPolicy::_S_alternate, true>
 	(__s, __e, __mm, __re, __flags);
-      // __m is unspecified if return value is false.
-      if (__res1 == __res2 && (!__res1 || __m == __mm))
+      if (__res1 == __res2 && __m == __mm)
 	return __res1;
       throw std::exception();
     }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-05 13:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 13:47 [gcc r12-6257] libstdc++: Compare match_results for failed regex_match Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).