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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <[email protected]>:

https://gcc.gnu.org/g:745e36a9acc6eb1d814ddd838dbcb5a7b724b3e2

commit r16-7041-g745e36a9acc6eb1d814ddd838dbcb5a7b724b3e2
Author: Marek Polacek <[email protected]>
Date:   Thu Jan 22 11:31:35 2026 -0500

    c++/reflection: fix fnptr extraction [PR123620]

    When extracting a function pointer, removing noexcept should be
    allowed (but not the other way round):

      int fn (int) noexcept;
      constexpr auto a = extract<int (*)(int)>(^^fn);

    but currently we reject this code -- I didn't realize that fnptr_conv_p
    allows things that same_type_p doesn't allow, and in can_extract_* we
    should check both.  And then we need to perform the actual conversion.

            PR c++/123620

    gcc/cp/ChangeLog:

            * reflect.cc (can_extract_member_or_function_p): Also check
            fnptr_conv_p.
            (extract_member_or_function): Call perform_implicit_conversion.

    gcc/testsuite/ChangeLog:

            * g++.dg/reflect/extract1.C: Test removing noexcept.
            * g++.dg/reflect/extract2.C: Adjust static_assert.

    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to