]> gcc.gnu.org Git - gcc.git/commit
ada: Fix bug in overloaded selected_components in aspect_specifications
authorBob Duff <duff@adacore.com>
Fri, 5 Jan 2024 15:40:00 +0000 (10:40 -0500)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 7 May 2024 07:55:52 +0000 (09:55 +0200)
commitd4b41cc4b02e365fc749dc90975af4d2360a8fb3
treee49a35a3b7c4b79dc85ac6004ea1137bf45bbf50
parent6fa5f50897c4beba0b55f0c0b76529758a5d24bd
ada: Fix bug in overloaded selected_components in aspect_specifications

This patch fixes a bug where if a selected_component X.Y appears in an
aspect_specification, and there are two or more overloaded Y's in X,
then it can choose the wrong one, leading to subsequent type errors.
It was always picking the last declaration of Y, and leaving Entity
set to that. We now reset Entity (as for the already-existing code
for N_Identifier just below).

Note that Resolve_Aspect_Expressions is called only for
aspect_specifications, and not even all aspect_specifications,
so the bug didn't occur for other names. For example,
Resolve_Aspect_Expressions is not called for aspect_specifications
in the visible part of a library package if there is no private part.

gcc/ada/

* sem_ch13.adb (Resolve_Name): This is called only for names in
aspect_specifications. If the name is an overloaded
selected_component, reset the Entity. Note that this was already
done for N_Identifier in the code just below.
gcc/ada/sem_ch13.adb
This page took 0.058611 seconds and 6 git commands to generate.