https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124201
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Eric Botcazou <[email protected]>: https://gcc.gnu.org/g:ed2908e642dbe4f04c94de6d196f3176a159ca4f commit r16-7747-ged2908e642dbe4f04c94de6d196f3176a159ca4f Author: Eric Botcazou <[email protected]> Date: Thu Feb 26 22:13:22 2026 +0100 Ada: Fix bogus visibility error for iterated element association with key The problem is that the Resolve_Iterated_Association procedure, unlike its sibling Resolve_Iterated_Component_Association, preanalyzes a copy of the specification so, in a generic context, global references cannot later be captured. This changes it to preanalyze the specification directly, which requires a small adjustment during expansion. gcc/ada/ PR ada/124201 * exp_aggr.adb (Expand_Iterated_Component): Replace the iteration variable in the key expression and iterator filter, if any. * sem_aggr.adb (Resolve_Iterated_Component_Association): Preanalyze the specification and key expression directly. gcc/testsuite/ * gnat.dg/generic_inst17.adb: New test.
