]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Fix error recovery for invalid arrays [PR123331]
authorJakub Jelinek <jakub@redhat.com>
Sat, 3 Jan 2026 11:15:30 +0000 (12:15 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 3 Jan 2026 11:15:30 +0000 (12:15 +0100)
commit66fbe318e2df40ff548bc22a7abe5fa8de88429c
treef3ecedb4f56216d973079c94bc0acf7a2965f807
parentdd84048bbe5377cf698407b11e9202c7f14fbe9e
c++: Fix error recovery for invalid arrays [PR123331]

The following testcase ICEs since the conditional
eltinit = build2 (INIT_EXPR, ...) has been added to cxx_eval_vec_init_1.

If there are errors, eltinit will be error_mark_node and we can ICE during
constant evaluation of that.

Fixed by skipping it for error operands.

2026-01-03  Jakub Jelinek  <jakub@redhat.com>

PR c++/123331
* constexpr.cc (cxx_eval_vec_init_1): Don't build INIT_EXPR if
eltinit is erroneous.

* g++.dg/other/pr123331.C: New test.
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/other/pr123331.C [new file with mode: 0644]