[Bug libstdc++/111550] The range adaptor closure object generated by adaptor(args...) is not a perfect forwarding call wrapper

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 5 17:38:24 GMT 2025


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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:5a2a527b26c22df4f1764f61b2285ac0c380ff68

commit r16-5918-g5a2a527b26c22df4f1764f61b2285ac0c380ff68
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Dec 5 12:16:30 2025 -0500

    libstdc++: Use deducing this in range adaptors even in C++20 [PR111550]

    Use deducing this to implement perfect forwarding even in C++20 mode
    by using the _GLIBCXX_EXPLICIT_THIS_PARAMETER internal FTM instead of
    the standard __cpp_explicit_this_parameter.  This fixes the original
    testcase from this PR even in C++20 mode.

            PR libstdc++/111550

    libstdc++-v3/ChangeLog:

            * include/std/ranges (views::__adaptor::_Partial::operator())
            [_GLIBCXX_EXPLICIT_THIS_PARAMETER]: Also use deducing this
            in C++20 mode when possible.
            (views::__adaptor::_Pipe::Operator())
            [_GLIBCXX_EXPLICIT_THIS_PARAMETER]: Likewise.
            * testsuite/std/ranges/adaptors/take.cc (test07): New test.

    Reviewed-by: Tomasz KamiÅski <tkaminsk@redhat.com>
    Reviewed-by: Jonathan Wakely <jwakely@redhat.com>


More information about the Gcc-bugs mailing list