This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/64441] A match_results returns an incorrect sub_match if the sub_match::matched is false
- From: "timshen at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 10 Mar 2015 18:42:18 +0000
- Subject: [Bug libstdc++/64441] A match_results returns an incorrect sub_match if the sub_match::matched is false
- Auto-submitted: auto-generated
- References: <bug-64441-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64441
--- Comment #4 from Tim Shen <timshen at gcc dot gnu.org> ---
Author: timshen
Date: Tue Mar 10 18:41:46 2015
New Revision: 221330
URL: https://gcc.gnu.org/viewcvs?rev=221330&root=gcc&view=rev
Log:
PR libstdc++/64441
* include/bits/regex.h (match_results<>::size,
match_results<>::position, match_results<>::str,
match_results<>::operator[], match_results<>::prefix,
match_results<>::suffix, match_results<>::end,
match_results<>::_M_resize, match_results<>::_M_unmatched_sub,
match_results<>::_M_prefix, match_results<>::_M_suffix): Remove
global __unmatched_sub. Add unmatched submatch as part of
match_results.
* include/bits/regex.tcc (__regex_algo_impl<>, regex_replace<>,
regex_iterator<>::operator++): Adjust to use match_results::_M_prefix.
* testsuite/28_regex/match_results/out_of_range_submatches.cc:
New testcases.
Added:
trunk/libstdc++-v3/testsuite/28_regex/match_results/out_of_range_submatches.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/regex.h
trunk/libstdc++-v3/include/bits/regex.tcc