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

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

https://gcc.gnu.org/g:9abe0b4f76265a062f1646a0bff1f58b70ae5695

commit r16-6954-g9abe0b4f76265a062f1646a0bff1f58b70ae5695
Author: Jakub Jelinek <[email protected]>
Date:   Wed Jan 21 14:30:03 2026 +0100

    c++: Fix ICE with constant evaluation of a = {CLOBBER} with ptrmemfn
[PR123677]

    The following testcase ICEs when we evaluate a = {CLOBBER} stmt.
    The code assumes that if type is an aggregate type and *valp is
    non-NULL, then it must be a CONSTRUCTOR.
    That is usually the case, but there is one exception, *valp can
    be a PTRMEM_CST if TYPE_PTRMEMFUNC_P (type) and in that
    case CONSTRUCTOR_ELTS (*valp) obviously ICEs or misbehaves.

    Now, while I could do something like
      if (*valp && (!TYPE_PTRMEMFUNC_P (type) || TREE_CODE (*valp) !=
PTRMEM_CST))
    just making sure TREE_CODE (*valp) == CONSTRUCTOR seems much easier
    and more readable.

    2026-01-21  Jakub Jelinek  <[email protected]>

            PR c++/123677
            * constexpr.cc (cxx_eval_store_expression): Only clear
            CONSTRUCTOR_ELTS (*valp) if *valp is CONSTRUCTOR.

            * g++.dg/cpp2a/pr123677.C: New test.

Reply via email to