diff options
4 files changed, 11 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5f0bcca..7011317 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,12 @@ 2017-11-15 Jonathan Wakely <jwakely@redhat.com> + * testsuite/27_io/filesystem/iterators/directory_iterator.cc: Leave + error_code unset. + * testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc: + Check for past-the-end before dereferencing. + * testsuite/experimental/filesystem/iterators/ + recursive_directory_iterator.cc: Likewise. + * include/bits/range_access.h (size, empty, data): Add conditional noexcept to generic overloads. diff --git a/libstdc++-v3/testsuite/27_io/filesystem/iterators/directory_iterator.cc b/libstdc++-v3/testsuite/27_io/filesystem/iterators/directory_iterator.cc index c3e6f01..9cdbd7a 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/iterators/directory_iterator.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/iterators/directory_iterator.cc @@ -61,7 +61,6 @@ test01() ec = bad_ec; permissions(p, fs::perms::none, ec); VERIFY( !ec ); - ec = bad_ec; iter = fs::directory_iterator(p, ec); VERIFY( ec ); VERIFY( iter == end(iter) ); diff --git a/libstdc++-v3/testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc b/libstdc++-v3/testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc index 1ef450f..d41a150 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc @@ -87,6 +87,7 @@ test01() VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1" ); ++iter; // should recurse into d1 + VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1/d2" ); iter.increment(ec); // should fail to recurse into p/d1/d2 VERIFY( ec ); @@ -99,6 +100,7 @@ test01() VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1" ); ++iter; // should recurse into d1 + VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1/d2" ); ec = bad_ec; iter.increment(ec); // should fail to recurse into p/d1/d2, so skip it diff --git a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc index 50cc7d4..584cfee 100644 --- a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc +++ b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc @@ -56,6 +56,7 @@ test01() VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1" ); ++iter; + VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1/d2" ); ++iter; VERIFY( iter == end(iter) ); @@ -88,6 +89,7 @@ test01() VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1" ); ++iter; // should recurse into d1 + VERIFY( iter != end(iter) ); VERIFY( iter->path() == p/"d1/d2" ); iter.increment(ec); // should fail to recurse into p/d1/d2 VERIFY( ec ); |