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

--- Comment #4 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:d6d8445c85509b66a59aa6247ad7b2cfeab17725

commit r15-3674-gd6d8445c85509b66a59aa6247ad7b2cfeab17725
Author: Marek Polacek <pola...@redhat.com>
Date:   Tue Sep 17 14:34:30 2024 -0400

    c++: fix constexpr cast from void* diag issue [PR116741]

    The result of build_fold_indirect_ref can be a COMPONENT_REF in
    which case using DECL_SOURCE_LOCATION will crash.  Look at its op1
    instead.

            PR c++/116741

    gcc/cp/ChangeLog:

            * constexpr.cc (cxx_eval_constant_expression) <case CONVERT_EXPR>:
If
            the result of build_fold_indirect_ref is a COMPONENT_REF, use its
op1.
            Check DECL_P before calling inform.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp26/constexpr-voidptr4.C: New test.

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

Reply via email to