https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102667

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<r...@gcc.gnu.org>:

https://gcc.gnu.org/g:2560bab6ceb7c1eb7c5cdadb5f0a608ac166b829

commit r11-9099-g2560bab6ceb7c1eb7c5cdadb5f0a608ac166b829
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Mon Oct 11 09:07:15 2021 +0100

    libstdc++: Fix std::match_results::end() for failed matches [PR102667]

    The end() function needs to consider whether the underlying vector is
    empty, not whether the match_results object is empty. That's because the
    underlying vector will always contain at least three elements for a
    match_results object that is "ready". It contains three extra elements
    which are stored in the vector but are not considered part of sequence,
    and so should not be part of the [begin(),end()) range.

    libstdc++-v3/ChangeLog:

            PR libstdc++/102667
            * include/bits/regex.h (match_result::empty()): Optimize by
            calling the base function directly.
            (match_results::end()): Check _Base_type::empty() not empty().
            * testsuite/28_regex/match_results/102667.C: New test.

    (cherry picked from commit 84088dc4bb6a546c896a068dc201463493babf43)

Reply via email to