]> git.feebdaed.xyz Git - 0xmirror/gcc.git/commit
Ada: Fix bogus error on aggregate in call with qualified type in instance
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 26 Dec 2025 13:52:32 +0000 (14:52 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 26 Dec 2025 13:56:48 +0000 (14:56 +0100)
commit875f1e3401153c17cf17ad022a807511eca7f6ee
treef12a15ad35c60410ecd623f995143fc75386b1b7
parent7b0a85ab6633f71e0488299b2b3a8e26b7cf7d78
Ada: Fix bogus error on aggregate in call with qualified type in instance

This happens with a container aggregate in the testcase, although this can
very likely happen with a record aggregate as well.  The trick used in the
Save_Global_References procedure for aggregates loses the qualification of
the type of the formal for which the aggregate is the actual.

gcc/ada/
PR ada/123302
* sem_ch12.adb (Save_Global_Reference.Save_References_In_Aggregate):
Recurse on the scope of the type to find one that is visible, in the
case of an actual in a subprogram call with a local type.

gcc/testsuite/
* gnat.dg/aggr34.adb: New test.
* gnat.dg/aggr34_pkg1.ads, gnat.dg/aggr34_pkg1.adb: New helper.
* gnat.dg/aggr34_pkg2.ads, gnat.dg/aggr34_pkg2.adb: Likewise.
* gnat.dg/aggr34_pkg3.ads: Likewise.
gcc/ada/sem_ch12.adb
gcc/testsuite/gnat.dg/aggr34.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/aggr34_pkg1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/aggr34_pkg1.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/aggr34_pkg2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/aggr34_pkg2.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/aggr34_pkg3.ads [new file with mode: 0644]