diff options
| author | Eric Botcazou <ebotcazou@adacore.com> | 2025-10-28 09:56:33 +0100 |
|---|---|---|
| committer | Eric Botcazou <ebotcazou@adacore.com> | 2025-10-28 10:16:01 +0100 |
| commit | 7d9296d0dfbe878598250d176e74b5732b811cff (patch) | |
| tree | a2183236e0c159b6c8847d0c39c52b873876323f /contrib/gcc-changelog/git_commit.py | |
| parent | f2763f36c1cb4f00b2fbe359564c1349f89e69a1 (diff) | |
| download | gcc-7d9296d0dfbe878598250d176e74b5732b811cff.zip gcc-7d9296d0dfbe878598250d176e74b5732b811cff.tar.gz gcc-7d9296d0dfbe878598250d176e74b5732b811cff.tar.bz2 | |
Ada: Fix generic formal subprogram with implicit default wrongly rejected
It's another issue with a formal subprogram parameter of a generic unit,
whose default is specified by a box and the actual is omitted, so an
implicit actual with the name of the formal is used instead and resolved
in the context of the instance.
The problem is that, for a child generic unit, the parent unit needs to be
loaded during the instantiation, but it cannot be used to resolve implicit
actuals, which must be resolved in the context of the instance. So an
ad-hoc mechanism is implemented to prune references to the parent unit(s)
for this resolution, but that's wrong if the parent unit was loaded at an
earlier point in the context of the instance.
The fix disables this ad-hoc mechanism in the case where the parent unit
has not been loaded during the instantiation by propagating the boolean
Parent_Installed flag through the call chain.
gcc/ada/
PR ada/34511
* sem_ch12.adb (Analyze_Associations): Add Parent_Installed formal
parameter and pass it in call to Analyze_One_Association.
(Analyze_One_Association): Add Parent_Installed formal parameter
and pass it in call to Instantiate_Formal_Subprogram.
(Analyze_Formal_Package_Declaration): Pass Parent_Installed in call
to Analyze_Associations.
(Analyze_Package_Instantiation): Likewise.
(Analyze_Subprogram_Instantiation): Likewise.
(Instantiate_Formal_Subprogram): Add Parent_Installed formal
parameter and prune references to the parent unit(s) only if
it is true.
gcc/testsuite/
* gnat.dg/specs/generic_inst4-child2.ads: New test.
* gnat.dg/specs/generic_inst4.ads: New helper.
* gnat.dg/specs/generic_inst4-child1.ads: Likewise.
Diffstat (limited to 'contrib/gcc-changelog/git_commit.py')
0 files changed, 0 insertions, 0 deletions
