https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108636

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<r...@gcc.gnu.org>:

https://gcc.gnu.org/g:05fa584bbb5534ec7a763a2d0e6d89cf251534f5

commit r11-10581-g05fa584bbb5534ec7a763a2d0e6d89cf251534f5
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Thu Feb 2 14:06:40 2023 +0000

    libstdc++: Fix std::filesystem errors with -fkeep-inline-functions
[PR108636]

    With -fkeep-inline-functions there are linker errors when including
    <filesystem>. This happens because there are some filesystem::path
    constructors defined inline which call non-exported functions defined in
    the library. That's usually not a problem, because those constructors
    are only called by code that's also inside the library. But when the
    header is compiled with -fkeep-inline-functions those inline functions
    are emitted even though they aren't called. That then creates an
    undefined reference to the other library internals. The fix is to just
    move the private constructors into the library where they are called.
    That way they are never even seen by users, and so not compiled even if
    -fkeep-inline-functions is used.

    libstdc++-v3/ChangeLog:

            PR libstdc++/108636
            * include/bits/fs_path.h (path::path(string_view, _Type))
            (path::_Cmpt::_Cmpt(string_view, _Type, size_t)): Move inline
            definitions to ...
            * src/c++17/fs_path.cc: ... here.
            * testsuite/27_io/filesystem/path/108636.cc: New test.

    (cherry picked from commit db8d6fc572ec316ccfcf70b1dffe3be0b1b37212)

Reply via email to