libstdc++: Add testcase for fs::path constraint recursion [PR106201]
authorJonathan Wakely <jwakely@redhat.com>
Tue, 22 Nov 2022 12:17:27 +0000 (12:17 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 22 Nov 2022 17:43:58 +0000 (17:43 +0000)
libstdc++-v3/ChangeLog:

PR libstdc++/106201
* testsuite/27_io/filesystem/iterators/106201.cc: New test.

libstdc++-v3/testsuite/27_io/filesystem/iterators/106201.cc [new file with mode: 0644]

diff --git a/libstdc++-v3/testsuite/27_io/filesystem/iterators/106201.cc b/libstdc++-v3/testsuite/27_io/filesystem/iterators/106201.cc
new file mode 100644 (file)
index 0000000..4a64e67
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-options "-std=gnu++20" }
+// { dg-do compile { target c++20 } }
+// { dg-require-filesystem-ts "" }
+
+// PR libstdc++/106201 constraint recursion in path(Source const&) constructor.
+
+#include <filesystem>
+#include <ranges>
+using I = std::counted_iterator<std::filesystem::directory_iterator>;
+static_assert( std::swappable<I> );
+using R = std::counted_iterator<std::filesystem::recursive_directory_iterator>;
+static_assert( std::swappable<R> );