[Bug libstdc++/122726] std::filesystem::rename() on Windows reports errc::io_error on any MoveFileExW error except ERROR_ACCESS_DENIED
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 18 12:47:49 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122726
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:d207ebcb5f728eca944e1f19401643b01d5e43f5
commit r15-10526-gd207ebcb5f728eca944e1f19401643b01d5e43f5
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Nov 17 21:01:33 2025 +0000
libstdc++: Fix error reporting for filesystem::rename on Windows [PR122726]
Use the __last_system_error() function and the system_category to
convert the Windows error to a generic one.
libstdc++-v3/ChangeLog:
PR libstdc++/122726
* src/filesystem/ops-common.h [_GLIBCXX_FILESYSTEM_IS_WINDOWS]
(rename): Use __last_system_error to set errno accurately.
* testsuite/27_io/filesystem/operations/rename.cc: Test
error_code matches errc::no_such_file_or_directory.
(cherry picked from commit 77278e0292cd23f0d1ddbb5e6e18064e119bdd6f)
More information about the Gcc-bugs
mailing list