https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125454
--- Comment #3 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:a33b41d895f55fd95f8c9f486f6ef23c71a7a1e5 commit r17-914-ga33b41d895f55fd95f8c9f486f6ef23c71a7a1e5 Author: Marek Polacek <[email protected]> Date: Thu May 28 13:43:58 2026 -0400 c++: fix infinite looping with arr[arr] [PR125454] Here r16-3466 moved the canonicalization step that transforms idx[array] to array[idx] to the beginning of cp_build_array_ref. When we have array[array], we'll be swapping till we blow the stack. Previously, we'd give the !INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P error so there was no problem. PR c++/125454 gcc/cp/ChangeLog: * typeck.cc (cp_build_array_ref): Don't recurse for array[array]. gcc/testsuite/ChangeLog: * g++.dg/other/array8.C: New test. Reviewed-by: Jason Merrill <[email protected]>
