]> git.ipfire.org Git - thirdparty/gcc.git/commit
Ada: Fix bogus visibility error for iterated element association with key
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 26 Feb 2026 21:13:22 +0000 (22:13 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Thu, 26 Feb 2026 21:14:20 +0000 (22:14 +0100)
commited2908e642dbe4f04c94de6d196f3176a159ca4f
tree92f7ef6e4ef8b9e1fc5aa4d2c608aa5ca32819dd
parenta8290fb163443276c3df6b20024c6874f93c560c
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.
gcc/ada/exp_aggr.adb
gcc/ada/sem_aggr.adb
gcc/testsuite/gnat.dg/generic_inst17.adb [new file with mode: 0644]