aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2020-04-07 05:22:52 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-16 09:07:14 -0400
commit51e2de474edf2be4997862eb878a5abf5b2a323b (patch)
treefacedad542b63aaa8f9e32e5aeee4ff4d930bba8
parente7680763dfd9ee980f95ffb865ef3ca7879d10c2 (diff)
downloadgcc-51e2de474edf2be4997862eb878a5abf5b2a323b.zip
gcc-51e2de474edf2be4997862eb878a5abf5b2a323b.tar.gz
gcc-51e2de474edf2be4997862eb878a5abf5b2a323b.tar.bz2
[Ada] ACATS 4.1P - C432003 - Errors missed on extension aggregates
2020-06-16 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * sem_aggr.adb (Resolve_Extension_Aggregate): Fix implementation of AI05-0115 by checking the correct type.
-rw-r--r--gcc/ada/sem_aggr.adb8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 210779c..3152305 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -3084,14 +3084,12 @@ package body Sem_Aggr is
Analyze (A);
Check_Parameterless_Call (A);
- -- In SPARK, the ancestor part cannot be a type mark
-
if Is_Entity_Name (A) and then Is_Type (Entity (A)) then
-- AI05-0115: if the ancestor part is a subtype mark, the ancestor
-- must not have unknown discriminants.
- if Has_Unknown_Discriminants (Root_Type (Typ)) then
+ if Has_Unknown_Discriminants (Entity (A)) then
Error_Msg_NE
("aggregate not available for type& whose ancestor "
& "has unknown discriminants", N, Typ);
@@ -4291,6 +4289,10 @@ package body Sem_Aggr is
-- AI05-0115: if the ancestor part is a subtype mark, the ancestor
-- must not have unknown discriminants.
+ -- ??? We are not checking any subtype mark here and this code is not
+ -- exercised by any test, so it's likely wrong (in particular
+ -- we should not use Root_Type here but the subtype mark, if any),
+ -- and possibly not needed.
if Is_Derived_Type (Typ)
and then Has_Unknown_Discriminants (Root_Type (Typ))