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

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

https://gcc.gnu.org/g:477b3f9d58589b3af7a5a7d038d78352ad66406e

commit r12-8927-g477b3f9d58589b3af7a5a7d038d78352ad66406e
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Tue Nov 22 18:15:56 2022 +0000

    libstdc++: Add workaround for fs::path constraint recursion [PR106201]

    This works around a compiler bug where overload resolution attempts
    implicit conversion to path in order to call a function with a path&
    parameter. Such conversion would produce a prvalue, which would not be
    able to bind to the lvalue reference anyway. Attempting to check the
    conversion causes a constraint recursion because the arguments to the
    path constructor are checked to see if they're iterators, which checks
    if they're swappable, which tries to use the swap function that
    triggered the conversion in the first place.

    This replaces the swap function with an abbreviated function template
    that is constrained with same_as<path> auto& so that the invalid
    conversion is never considered.

    libstdc++-v3/ChangeLog:

            PR libstdc++/106201
            * include/bits/fs_path.h (filesystem::swap(path&, path&)):
            Replace with abbreviated function template.
            * include/experimental/bits/fs_path.h (filesystem::swap):
            Likewise.
            * testsuite/27_io/filesystem/iterators/106201.cc: New test.
            * testsuite/experimental/filesystem/iterators/106201.cc: New test.

Reply via email to