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

--- Comment #6 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:5686e69266cff73830551db19766c39bc83e3dd3

commit r16-8536-g5686e69266cff73830551db19766c39bc83e3dd3
Author: Marek Polacek <[email protected]>
Date:   Wed Mar 18 13:48:40 2026 -0400

    c++/reflection: ICE with invalid splice in member access expr [PR123726]

    This patch fixes a crash on invalid code.  In a class member access
    with a splice, the splice cannot designate something that is not
    a member of the object we're accessing.  check_splice_expr could also
    detect more invalid splices, such as accessing a class template or
    alias template member with . or ->.

            PR c++/123726

    gcc/cp/ChangeLog:

            * reflect.cc (check_splice_expr): Detect accessing a class template
            or alias template with . or ->.
            * typeck.cc (finish_class_member_access_expr): Check if the scope
of
            the spliced entity in a member access expression is of a class
type.
            Allow variable_template_p for context_for_name_lookup.

    gcc/testsuite/ChangeLog:

            * g++.dg/reflect/member1.C: Adjust dg-error.
            * g++.dg/reflect/member22.C: New test.

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

Reply via email to