* include/experimental/bits/fs_dir.h (begin, end): Add noexcept.
* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
Test begin and end functions.
* testsuite/experimental/filesystem/iterators/
recursive_directory_iterator.cc: Likewise.
From-SVN: r236085
2016-05-10 Jonathan Wakely <jwakely@redhat.com>
+ * include/experimental/bits/fs_dir.h (begin, end): Add noexcept.
+ * testsuite/experimental/filesystem/iterators/directory_iterator.cc:
+ Test begin and end functions.
+ * testsuite/experimental/filesystem/iterators/
+ recursive_directory_iterator.cc: Likewise.
+
PR libstdc++/71038
* src/filesystem/ops.cc (do_copy_file): Fix backwards conditions.
* testsuite/experimental/filesystem/operations/copy_file.cc: New test.
};
inline directory_iterator
- begin(directory_iterator __iter) { return __iter; }
+ begin(directory_iterator __iter) noexcept
+ { return __iter; }
inline directory_iterator
- end(directory_iterator) { return directory_iterator(); }
+ end(directory_iterator) noexcept
+ { return directory_iterator(); }
inline bool
operator==(const directory_iterator& __lhs, const directory_iterator& __rhs)
};
inline recursive_directory_iterator
- begin(recursive_directory_iterator __iter) { return __iter; }
+ begin(recursive_directory_iterator __iter) noexcept
+ { return __iter; }
inline recursive_directory_iterator
- end(recursive_directory_iterator) { return recursive_directory_iterator(); }
+ end(recursive_directory_iterator) noexcept
+ { return recursive_directory_iterator(); }
inline bool
operator==(const recursive_directory_iterator& __lhs,
remove_all(p, ec);
}
+void
+test04()
+{
+ bool test __attribute__((unused)) = false;
+
+ const fs::directory_iterator it;
+ VERIFY( it == fs::directory_iterator() );
+}
+
+void
+test05()
+{
+ bool test __attribute__((unused)) = false;
+
+ auto p = __gnu_test::nonexistent_path();
+ create_directory(p);
+ create_directory_symlink(p, p / "l");
+ fs::directory_iterator it(p), endit;
+ VERIFY( begin(it) == it );
+ static_assert( noexcept(begin(it)), "begin is noexcept" );
+ VERIFY( end(it) == endit );
+ static_assert( noexcept(end(it)), "end is noexcept" );
+}
+
int
main()
{
test01();
test02();
test03();
+ test04();
+ test05();
}
VERIFY( it == fs::recursive_directory_iterator() );
}
+void
+test05()
+{
+ bool test __attribute__((unused)) = false;
+
+ auto p = __gnu_test::nonexistent_path();
+ create_directory(p);
+ create_directory_symlink(p, p / "l");
+ fs::recursive_directory_iterator it(p), endit;
+ VERIFY( begin(it) == it );
+ static_assert( noexcept(begin(it)), "begin is noexcept" );
+ VERIFY( end(it) == endit );
+ static_assert( noexcept(end(it)), "end is noexcept" );
+}
+
int
main()
{
test02();
test03();
test04();
+ test05();
}