aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-09-28 15:05:38 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-11-24 05:16:00 -0500
commit3e65b68dd67e45ae54aa47f41a1f8a8d8296cf26 (patch)
tree4721647eafe7c38e27a08ed7594568ba1a8d9c5a
parent3ac0642304f83feda52d9285083a4e637e33e3d6 (diff)
downloadgcc-3e65b68dd67e45ae54aa47f41a1f8a8d8296cf26.zip
gcc-3e65b68dd67e45ae54aa47f41a1f8a8d8296cf26.tar.gz
gcc-3e65b68dd67e45ae54aa47f41a1f8a8d8296cf26.tar.bz2
[Ada] Fix resolution of subtype_indication in delta aggregates
gcc/ada/ * sem_aggr.adb (Resolve_Delta_Array_Aggregate): If the choice is a subtype_indication then call Resolve_Discrete_Subtype_Indication; both for choices immediately inside array delta aggregates and inside iterated_component_association within array delta aggregates.
-rw-r--r--gcc/ada/sem_aggr.adb37
1 files changed, 22 insertions, 15 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 3f96139..1ba5870 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -3072,6 +3072,10 @@ package body Sem_Aggr is
Error_Msg_N
("others not allowed in delta aggregate", Choice);
+ elsif Nkind (Choice) = N_Subtype_Indication then
+ Resolve_Discrete_Subtype_Indication
+ (Choice, Base_Type (Index_Type));
+
else
Analyze_And_Resolve (Choice, Index_Type);
end if;
@@ -3109,28 +3113,31 @@ package body Sem_Aggr is
else
Choice := First (Choice_List (Assoc));
while Present (Choice) loop
+ Analyze (Choice);
+
if Nkind (Choice) = N_Others_Choice then
Error_Msg_N
("others not allowed in delta aggregate", Choice);
- else
- Analyze (Choice);
+ elsif Is_Entity_Name (Choice)
+ and then Is_Type (Entity (Choice))
+ then
+ -- Choice covers a range of values
- if Is_Entity_Name (Choice)
- and then Is_Type (Entity (Choice))
+ if Base_Type (Entity (Choice)) /=
+ Base_Type (Index_Type)
then
- -- Choice covers a range of values
-
- if Base_Type (Entity (Choice)) /=
- Base_Type (Index_Type)
- then
- Error_Msg_NE
- ("choice does not match index type of &",
- Choice, Typ);
- end if;
- else
- Resolve (Choice, Index_Type);
+ Error_Msg_NE
+ ("choice does not match index type of &",
+ Choice, Typ);
end if;
+
+ elsif Nkind (Choice) = N_Subtype_Indication then
+ Resolve_Discrete_Subtype_Indication
+ (Choice, Base_Type (Index_Type));
+
+ else
+ Resolve (Choice, Index_Type);
end if;
Next (Choice);