]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Delay expansion of iterated component association
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 12 Sep 2022 13:33:15 +0000 (15:33 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 26 Sep 2022 09:02:30 +0000 (11:02 +0200)
When preanalysing spec expression (e.g. expression of an expression
function), the name of iterator specification within an iterated
component association should not be expanded, especially in GNATprove
mode.

gcc/ada/

* sem_ch5.adb (Analyze_Iterator_Specification): Delay expansion of
for iterated component association just like it is done within
quantified expression.

gcc/ada/sem_ch5.adb

index 17bf6d91b44bb6e89c0923d6f166e7dceb87a843..6d07f3d09e581fd9fea42dd38b83e89bb8513e3f 100644 (file)
@@ -2429,11 +2429,12 @@ package body Sem_Ch5 is
 
       if not Is_Entity_Name (Iter_Name)
 
-        --  When the context is a quantified expression, the renaming
-        --  declaration is delayed until the expansion phase if we are
-        --  doing expansion.
+        --  When the context is a quantified expression or iterated component
+        --  association, the renaming declaration is delayed until the
+        --  expansion phase if we are doing expansion.
 
-        and then (Nkind (Parent (N)) /= N_Quantified_Expression
+        and then (Nkind (Parent (N)) not in N_Quantified_Expression
+                                          | N_Iterated_Component_Association
                    or else (Operating_Mode = Check_Semantics
                             and then not GNATprove_Mode))