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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>:

https://gcc.gnu.org/g:6fc1f70f0b7b50fd85aa58a0f29dd1e17f2113d1

commit r15-8280-g6fc1f70f0b7b50fd85aa58a0f29dd1e17f2113d1
Author: Marek Polacek <pola...@redhat.com>
Date:   Mon Mar 17 17:46:02 2025 -0400

    c++: ICE with ptr-to-member-fn [PR119344]

    This ICE appeared with the removal of NON_DEPENDENT_EXPR.  Previously
    skip_simple_arithmetic would get NON_DEPENDENT_EXPR<CAST_EXPR<>> and
    since NON_DEPENDENT_EXPR is neither BINARY_CLASS_P nor UNARY_CLASS_P,
    there was no problem.  But now we pass just CAST_EXPR<> and a CAST_EXPR
    is a tcc_unary, so we extract its null operand and crash.

    skip_simple_arithmetic is called from save_expr.  cp_save_expr already
    avoids calling save_expr in a template, so that seems like an appropriate
    way to fix this.

            PR c++/119344

    gcc/cp/ChangeLog:

            * typeck.cc (cp_build_binary_op): Use cp_save_expr instead of
save_expr.

    gcc/testsuite/ChangeLog:

            * g++.dg/conversion/ptrmem10.C: New test.

    Reviewed-by: Patrick Palka <ppa...@redhat.com>
    Reviewed-by: Jason Merrill <ja...@redhat.com>

Reply via email to