]> gcc.gnu.org Git - gcc.git/commit
libstdc++: Use non-throwing increment in recursive_directory_iterator [PR 97731]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 5 Nov 2020 17:26:13 +0000 (17:26 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 9 Nov 2020 14:53:29 +0000 (14:53 +0000)
commitc9769a6eee38c396b797cffd819957fa9f1926b1
tree80fb2a2e3dc9c6911c09dd23be92d820a707ae46
parent97dd08aa244af1e236dec54c014a3e03d34594d0
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)
libstdc++-v3/src/filesystem/dir.cc
libstdc++-v3/testsuite/experimental/filesystem/iterators/97731.cc [new file with mode: 0644]
This page took 0.062343 seconds and 6 git commands to generate.