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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Jakub Jelinek
<[email protected]>:

https://gcc.gnu.org/g:38dc98d81ed0d673d648031732f84f807ce24eb3

commit r16-8910-g38dc98d81ed0d673d648031732f84f807ce24eb3
Author: Jakub Jelinek <[email protected]>
Date:   Thu May 7 08:54:21 2026 +0200

    c++: Fix up extract_ref [PR125111]

    https://eel.is/c++draft/meta.reflection.extract#5.2 requests that
    is_convertible_v<remove_reference_t<U>(*)[], remove_reference_t<T>(*)[]>
    is tested and if it not true, the function throws.
    If U/T are references to function/method/array[], we try to build
    array of types which are not valid in arrays and ICE shortly after that.
    The following patch makes sure we don't create arrays in that case
    and instead just throw the exception.  We can't have references to void
    or references to references, so I think the other problematic cases
    of creating arrays can't trigger.

    2026-05-07  Jakub Jelinek  <[email protected]>

            PR c++/125111
            * reflect.cc (extract_ref): Throw instead of trying to build
            arrays of functions, methods or arrays with NULL TYPE_DOMAIN.

            * g++.dg/reflect/extract12.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>
    (cherry picked from commit ef48b322cd98e23de57ad0d8f09ec02aa97d40c4)

Reply via email to