https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106201
Bug ID: 106201 Summary: filesystem::directory_iterator is a borrowable range? Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: prlw1 at cam dot ac.uk Target Milestone: --- In the following: #include <algorithm> #include <filesystem> #include <iostream> #include <ranges> int main() { auto print = [](const auto& x) {std::cout << x << '\n';} ; std::ranges::for_each( std::views::iota(1) | std::views::take(5), print ); std::ranges::for_each( std::filesystem::directory_iterator("/"), print ); std::ranges::for_each( std::filesystem::directory_iterator("/") | std::views::take(3), print ); } the first two for_each clauses compile and execute correctly, even with g++ 10.3.0. Is my expectation that the third clause is valid incorrect? (I just tried with today's head, g++ (GCC) 13.0.0 20220705 (experimental) and it failed to compile.) Oh: https://cplusplus.github.io/LWG/issue3480 But: it says "could be fixed ... (as libstdc++ currently does anyway)" Issue looks resolved? Thoughts?