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.
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) );
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 );
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
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) );
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 );