Array_Dim : constant Pos := Number_Dimensions (Array_Typ);
Id : constant Entity_Id := Defining_Identifier (I_Spec);
Loc : constant Source_Ptr := Sloc (Isc);
- Stats : List_Id := Statements (N);
+
+ Stats : List_Id := Statements (N);
+ -- Maybe wrapped in a conditional if a filter is present
+
Core_Loop : Node_Id;
Dim1 : Int;
Ind_Comp : Node_Id;
Id_Kind : constant Entity_Kind := Ekind (Id);
Loc : constant Source_Ptr := Sloc (N);
- Stats : List_Id := Statements (N);
+ Stats : List_Id := Statements (N);
-- Maybe wrapped in a conditional if a filter is present
Cursor : Entity_Id;
Loop_Id : constant Entity_Id := Defining_Identifier (LPS);
Ltype : constant Entity_Id := Etype (Loop_Id);
Btype : constant Entity_Id := Base_Type (Ltype);
- Stats : constant List_Id := Statements (N);
+
Expr : Node_Id;
Decls : List_Id;
New_Id : Entity_Id;
Set_Statements (N,
New_List (Make_If_Statement (Loc,
Condition => Iterator_Filter (LPS),
- Then_Statements => Stats)));
+ Then_Statements => Statements (N))));
Analyze_List (Statements (N));
end if;
Declarations => Decls,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
- Statements => Stats))),
+ Statements => Statements (N)))),
End_Label => End_Label (N)));
--- /dev/null
+-- { dg-do run }
+-- { dg-options "-gnat2022" }
+
+procedure Iter7 is
+
+ type Enum is (A, B, C);
+ for Enum use (A => 1, B => 2, C => 3);
+
+ Enum_Filter : array (Enum) of Boolean := (others => False);
+
+begin
+ for F in Enum when Enum_Filter (F) loop
+ raise Program_Error;
+ end loop;
+end;