[Ada] Fix scope of index parameter inside a delta aggregate
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 5 Aug 2020 22:53:11 +0000 (00:53 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 23 Oct 2020 08:24:47 +0000 (04:24 -0400)
gcc/ada/

* sem_aggr.adb (Resolve_Delta_Array_Aggregate): Push scope of
the implicit loop before entering name of the index parameter,
not after; enter name no matter if the identifier has been
decorated before.

gcc/ada/sem_aggr.adb

index 688937e19e9c2b6ed4c0589315ef69bc82a6c5d6..d6d0083b2580d43adff15b27192157a43d5201bb 100644 (file)
@@ -3052,15 +3052,15 @@ package body Sem_Aggr is
             begin
                Set_Etype  (Ent, Standard_Void_Type);
                Set_Parent (Ent, Assoc);
+               Push_Scope (Ent);
 
                if No (Scope (Id)) then
-                  Enter_Name (Id);
                   Set_Etype (Id, Index_Type);
                   Set_Ekind (Id, E_Variable);
                   Set_Scope (Id, Ent);
                end if;
+               Enter_Name (Id);
 
-               Push_Scope (Ent);
                Analyze_And_Resolve
                  (New_Copy_Tree (Expression (Assoc)), Component_Type (Typ));
                End_Scope;