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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tomasz Kaminski <tkami...@gcc.gnu.org>:

https://gcc.gnu.org/g:7dd28f0a815cdaf52b6f8f6039cabfde256aacc1

commit r16-4059-g7dd28f0a815cdaf52b6f8f6039cabfde256aacc1
Author: Tomasz KamiÅski <tkami...@redhat.com>
Date:   Tue Sep 23 08:54:28 2025 +0200

    libstdc++: Make function_ref(nontype<f>, r) CTAD SFINAE friendly [PR121940]

    Instantiating the __deduce_funcref function body for function pointers
    without arguments or member pointers with non-matching object types
    previously led to hard errors due to the formation of invalid types.

    The __deduce_funcref function is now adjusted to return void in such
    cases. The corresponding function_ref deduction guide is constrained to
    only match if the return type is not void, making it SFINAE friendly.

            PR libstdc++/121940

    libstdc++-v3/ChangeLog:

            * include/bits/funcwrap.h (__polyfunc::__deduce_funcref): Return
void
            for ill-formed constructs.
            (function_ref(nontype_t<__f>, _Tp&&)): Constrain on
__deduce_funcref
            producing non-void results.
            * testsuite/20_util/function_ref/deduction.cc: Negative tests.

    Reviewed-by: Jonathan Wakely <jwak...@redhat.com>
    Signed-off-by: Tomasz KamiÅski <tkami...@redhat.com>

Reply via email to