[Bug c++/123620] [reflection] extract: fnptr conv removing noexcept
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jan 26 13:49:58 GMT 2026
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 <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:745e36a9acc6eb1d814ddd838dbcb5a7b724b3e2
commit r16-7041-g745e36a9acc6eb1d814ddd838dbcb5a7b724b3e2
Author: Marek Polacek <polacek@redhat.com>
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 <jason@redhat.com>
More information about the Gcc-bugs
mailing list