]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Reject record delta aggregates with limited expressions
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 14 Oct 2021 10:48:12 +0000 (12:48 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 8 Nov 2022 08:34:57 +0000 (09:34 +0100)
Implement a missing check related to record delta aggregates.

gcc/ada/

* sem_aggr.adb (Resolve_Delta_Record_Aggregate): Reject
expressions of a limited types.

gcc/ada/sem_aggr.adb

index 31ce9cadd94f109b6536246b6368d435a22fad84..383f18f7301f473d27ab67dfb9e6d33aee4dd762 100644 (file)
@@ -3746,7 +3746,17 @@ package body Sem_Aggr is
               ("'<'> in record delta aggregate is not allowed", Assoc);
          else
             Analyze_And_Resolve (Expression (Assoc), Comp_Type);
+
+            --  The expression must not be of a limited type; RM 4.3.1(17.4/5)
+
+            if Is_Limited_Type (Etype (Expression (Assoc))) then
+               Error_Msg_N
+                 ("expression of a limited type in record delta aggregate " &
+                    "is not allowed",
+                  Expression (Assoc));
+            end if;
          end if;
+
          Next (Assoc);
       end loop;
    end Resolve_Delta_Record_Aggregate;