diff mbox series

[COMMITTED] ada: Reject record delta aggregates with limited expressions

Message ID 20221108084144.300867-1-poulhies@adacore.com
State New
Headers show
Series [COMMITTED] ada: Reject record delta aggregates with limited expressions | expand

Commit Message

Marc Poulhiès Nov. 8, 2022, 8:41 a.m. UTC
From: Piotr Trojanek <trojanek@adacore.com>

Implement a missing check related to record delta aggregates.

gcc/ada/

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

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_aggr.adb | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 31ce9cadd94..383f18f7301 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -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;