https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104161
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- This reduces the scope of the problem, but if the directory is replaced with a symlink *after* constructing the directory_iterator then filesystem::remove can still remove the wrong things. We really need to unlinkat, using a file descriptor obtained from dirfd on the iterator's DIR*.