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

--- Comment #5 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:6b2a3804758bb8e731ad18420cf79fd03cf280d9

commit r16-7243-g6b2a3804758bb8e731ad18420cf79fd03cf280d9
Author: Marek Polacek <[email protected]>
Date:   Sun Feb 1 18:06:20 2026 -0500

    c++/reflection: fix ICE with object_of [PR123695]

    In eval_object_of we are calling cxx_eval_constant_expression on
    references to get the referent.  We should check that the type is
    non-null before checking TYPE_REF_P, because for invalid arguments
    it can be null, as shown in the test.

            PR c++/123695

    gcc/cp/ChangeLog:

            * reflect.cc (eval_object_of): Check type before TYPE_REF_P.

    gcc/testsuite/ChangeLog:

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

    Co-authored-by: Boris Staletic <[email protected]>
    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to