diff options
author | Arnaud Charlet <charlet@adacore.com> | 2020-02-17 12:41:37 -0500 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-06-08 03:51:10 -0400 |
commit | 4b8c2c4ba3566f8dd6d256e4b93321410782a0b4 (patch) | |
tree | aaf437ff87e097d88686df3196640419c85f94fe /gcc/ada/sem_ch8.adb | |
parent | 8eda13a49e566270f04323dbec11b2e86d3ddccc (diff) | |
download | gcc-4b8c2c4ba3566f8dd6d256e4b93321410782a0b4.zip gcc-4b8c2c4ba3566f8dd6d256e4b93321410782a0b4.tar.gz gcc-4b8c2c4ba3566f8dd6d256e4b93321410782a0b4.tar.bz2 |
[Ada] AI12-0228 Properties of qualified expressions used as names
2020-06-08 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* sem_ch8.adb (Analyze_Object_Renaming): Update Get_Object_Name
to go through N_Qualified_Expression and N_Type_Conversion. Fix
another case of wrong usage of E_Anonymous_Access_Type instead
of Anonymous_Access_Kind.
* sem_util.adb (Is_Dependent_Component_Of_Mutable_Object): Work
on the original node.
(Is_Aliased_View): Take into account N_Qualified_Expression.
Diffstat (limited to 'gcc/ada/sem_ch8.adb')
-rw-r--r-- | gcc/ada/sem_ch8.adb | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 709a839..4d9b5ba 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -844,18 +844,23 @@ package body Sem_Ch8 is begin Obj_Nam := Nod; while Present (Obj_Nam) loop - if Nkind_In (Obj_Nam, N_Attribute_Reference, - N_Explicit_Dereference, - N_Indexed_Component, - N_Slice) - then - Obj_Nam := Prefix (Obj_Nam); + case Nkind (Obj_Nam) is + when N_Attribute_Reference + | N_Explicit_Dereference + | N_Indexed_Component + | N_Slice + => + Obj_Nam := Prefix (Obj_Nam); - elsif Nkind (Obj_Nam) = N_Selected_Component then - Obj_Nam := Selector_Name (Obj_Nam); - else - exit; - end if; + when N_Selected_Component => + Obj_Nam := Selector_Name (Obj_Nam); + + when N_Qualified_Expression | N_Type_Conversion => + Obj_Nam := Expression (Obj_Nam); + + when others => + exit; + end case; end loop; return Obj_Nam; @@ -1046,8 +1051,8 @@ package body Sem_Ch8 is if Nkind (Nam) = N_Type_Conversion and then not Comes_From_Source (Nam) - and then Ekind (Etype (Expression (Nam))) = E_Anonymous_Access_Type - and then Ekind (T) /= E_Anonymous_Access_Type + and then Ekind (Etype (Expression (Nam))) in Anonymous_Access_Kind + and then Ekind (T) not in Anonymous_Access_Kind then Wrong_Type (Expression (Nam), T); -- Should we give better error??? end if; |