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

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

https://gcc.gnu.org/g:c9769a6eee38c396b797cffd819957fa9f1926b1

commit r9-9034-gc9769a6eee38c396b797cffd819957fa9f1926b1
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Thu Nov 5 17:26:13 2020 +0000

    libstdc++: Use non-throwing increment in recursive_directory_iterator [PR
97731]

    As described in the PR, the recursive_directory_iterator constructor
    calls advance(ec), but ec is a pointer so it calls _Dir::advance(bool).
    The intention was to either call advance() or advance(*ec) depending
    whether the pointer is null or not.

    This fixes the bug and renames the parameter to ecptr to make similar
    mistakes less likely in future.

    libstdc++-v3/ChangeLog:

            PR libstdc++/97731
            * src/filesystem/dir.cc (recursive_directory_iterator): Call the
            right overload of _Dir::advance.
            * testsuite/experimental/filesystem/iterators/97731.cc: New test.

    (cherry picked from commit 2f93a2a03a343a29f614a530d7657f1ed6347ed5)

Reply via email to