diff options
author | Martin Liska <mliska@suse.cz> | 2022-11-08 12:36:43 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-11-08 12:36:43 +0100 |
commit | 4b13c73bba935443be3207abf26f7ba05f79badc (patch) | |
tree | a6bb1525d07859fa8fc6f61dd13df7ddfd1ac254 /gcc/ada/sem_aggr.adb | |
parent | 33f5dde0cd15df9cf89b29280d4ff5fcf7b30e66 (diff) | |
parent | fa271afb58423014e2feef9f15c1a87428e64ddc (diff) | |
download | gcc-devel/sphinx.tar.gz |
Merge branch 'master' into devel/sphinxdevel/sphinx
Diffstat (limited to 'gcc/ada/sem_aggr.adb')
-rw-r--r-- | gcc/ada/sem_aggr.adb | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 31ce9cadd94..3a093d26007 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -1052,7 +1052,7 @@ package body Sem_Aggr is elsif Is_Array_Type (Typ) and then Null_Record_Present (N) then Error_Msg_N ("null record forbidden in array aggregate", N); - elsif Present (Find_Aspect (Typ, Aspect_Aggregate)) + elsif Has_Aspect (Typ, Aspect_Aggregate) and then Ekind (Typ) /= E_Record_Type and then Ada_Version >= Ada_2022 then @@ -3421,6 +3421,18 @@ package body Sem_Aggr is Analyze_And_Resolve (Base, Typ); if Is_Array_Type (Typ) then + -- For an array_delta_aggregate, the base_expression and each + -- expression in every array_component_association shall be of a + -- nonlimited type; RM 4.3.4(13/5). However, to prevent repeated + -- errors we only check the base expression and not array component + -- associations. + + if Is_Limited_Type (Etype (Base)) then + Error_Msg_N + ("array delta aggregate shall be of a nonlimited type", Base); + Explain_Limited_Type (Etype (Base), Base); + end if; + Resolve_Delta_Array_Aggregate (N, Typ); else @@ -3432,6 +3444,11 @@ package body Sem_Aggr is ("delta aggregates for record types must use (), not '[']", N); end if; + -- The base_expression of a record_delta_aggregate can be of a + -- limited type only if it is newly constructed; RM 7.5(2.1/5). + + Check_Expr_OK_In_Limited_Aggregate (Base); + Resolve_Delta_Record_Aggregate (N, Typ); end if; @@ -3746,7 +3763,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; |