https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95048
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- Using std::codecvt_utf8<wchar_t> fixes it: --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -836,8 +836,7 @@ namespace __detail } } #else // ! windows - struct _UCvt : std::codecvt<_CharT, char, std::mbstate_t> - { } __cvt; + struct _UCvt : std::codecvt_utf8<_CharT> { } __cvt; std::string __str; if (__str_codecvt_out_all(__f, __l, __str, __cvt)) return __str;