https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94681
Bug ID: 94681 Summary: filesystem::sysmlink_status using stat instead of lstat when --disable-libstdcxx-filesystem-ts Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: valentin.david at codethink dot co.uk Target Milestone: --- Created attachment 48321 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48321&action=edit Proposed fix std::filesystem::sysmlink_status follows symlinks when GCC has been configured with --disable-libstdcxx-filesystem-ts, but it works fine when it has been configured with --enable-libstdcxx-filesystem-ts. The reason is that libstdc++-v3/src/c++17/fs_ops.cc includes libstdc++-v3/src/filesystem/ops-common.h which has some requirements in the configure script that are not executed. In libstdc++-v3/acinclude.m4, GLIBCXX_CHECK_FILESYSTEM_DEPS is guarded by test "$enable_libstdcxx_filesystem_ts = yes". But this should be run even if enable_libstdcxx_filesystem_ts is "no" since libstdc++-v3/src/filesystem/ops-common.h is used when --disable-libstdcxx-filesystem-ts is used. Removing this "if" fixed the issue for me. While I have not tested master, I believe the issue is still there.