This patch fixes an error in ASIS mode when processing queries on a static
predicate for an enumeration type that involves a case expression. 

Tested on x86_64-pc-linux-gnu, committed on trunk

2017-09-18  Ed Schonberg  <schonb...@adacore.com>

        * sem_ch3.adb (Analyze_Declarations): In ASIS mode,  At the end of the
        declarative list in a subprogram body, analyze aspext specifications to
        provide basic semantic information, because otherwise the aspect
        specifications might only be snalyzed during expansion, when related
        subprograms are generated.

Index: sem_ch3.adb
===================================================================
--- sem_ch3.adb (revision 252907)
+++ sem_ch3.adb (working copy)
@@ -2666,6 +2666,16 @@
                   Freeze_From := Last_Entity (Current_Scope);
 
                else
+                  --  For declarations in a subprogram body there is no issue
+                  --  with name resolution in aspect specifications, but in
+                  --  ASIS mode we need to preanalyze aspect specifications
+                  --  that may otherwise only be analyzed during expansion
+                  --  (e.g. during generation of a related subprogram).
+
+                  if ASIS_Mode then
+                     Resolve_Aspects;
+                  end if;
+
                   Freeze_All (First_Entity (Current_Scope), Decl);
                   Freeze_From := Last_Entity (Current_Scope);
                end if;
@@ -13510,6 +13520,7 @@
          end if;
 
          Constrain_Discriminated_Type (Def_Id, SI, Related_Nod);
+         Set_First_Private_Entity (Def_Id, First_Private_Entity (T_Ent));
 
          Set_Depends_On_Private (Def_Id, Has_Private_Component (Def_Id));
          Set_Corresponding_Record_Type (Def_Id,

Reply via email to