diff options
author | Javier Miranda <miranda@adacore.com> | 2020-06-02 15:46:10 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-07-15 09:42:44 -0400 |
commit | 3a9222bcb363bff255dc78d2a4aef0ac08da6274 (patch) | |
tree | 022664cb08d1d725cf5258c097f68237a280ad3d | |
parent | 3c75d0f23c01a51a795ffa9c31d1c0b09a38417b (diff) | |
download | gcc-3a9222bcb363bff255dc78d2a4aef0ac08da6274.zip gcc-3a9222bcb363bff255dc78d2a4aef0ac08da6274.tar.gz gcc-3a9222bcb363bff255dc78d2a4aef0ac08da6274.tar.bz2 |
[Ada] Wrong resolution of 'access in protected subprogram
gcc/ada/
* sem_attr.adb (Resolve_Attribute): Resolve overloaded
N_Selected_Component prefix of 'Access. Required to handle
overloaded prefixed view of protected subprograms.
-rw-r--r-- | gcc/ada/sem_attr.adb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 80e8f09..1a80e79 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -11023,7 +11023,29 @@ package body Sem_Attr is end if; Resolve (Prefix (P)); - Generate_Reference (Entity (Selector_Name (P)), P); + + if not Is_Overloaded (P) then + Generate_Reference (Entity (Selector_Name (P)), P); + + else + Get_First_Interp (P, Index, It); + while Present (It.Nam) loop + if Type_Conformant (Designated_Type (Typ), It.Nam) then + Set_Entity (Selector_Name (P), It.Nam); + + -- The prefix is definitely NOT overloaded anymore at + -- this point, so we reset the Is_Overloaded flag to + -- avoid any confusion when reanalyzing the node. + + Set_Is_Overloaded (P, False); + Set_Is_Overloaded (N, False); + Generate_Reference (Entity (Selector_Name (P)), P); + exit; + end if; + + Get_Next_Interp (Index, It); + end loop; + end if; -- Implement check implied by 3.10.2 (18.1/2) : F.all'access is -- statically illegal if F is an anonymous access to subprogram. |