diff options
author | Ed Schonberg <schonberg@adacore.com> | 2021-04-26 13:32:06 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-07-05 13:09:10 +0000 |
commit | 0b8880428c4da92886b069af714365019f660ade (patch) | |
tree | d91f97e9a46a31c31916a8c3a04515fe9441f4fa | |
parent | 243573ff080ed436d8cd9a3273e509ee436434d9 (diff) | |
download | gcc-0b8880428c4da92886b069af714365019f660ade.zip gcc-0b8880428c4da92886b069af714365019f660ade.tar.gz gcc-0b8880428c4da92886b069af714365019f660ade.tar.bz2 |
[Ada] Spurious error in instantiation with aggregate and private ancestor
gcc/ada/
* sem_aggr.adb (Resolve_Record_Aggregate, Step_5): Do not check
for the need to use an extension aggregate for a given component
when within an instance and the type of the component hss a
private ancestor: the instantiation is legal if the generic
compiles, and spurious errors may be generated otherwise.
-rw-r--r-- | gcc/ada/sem_aggr.adb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index d189ab7..9ad9629 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -5028,12 +5028,19 @@ package body Sem_Aggr is Prepend_Elmt (Parent_Typ, To => Parent_Typ_List); Parent_Typ := Etype (Parent_Typ); + -- Check whether a private parent requires the use of + -- an extension aggregate. This test does not apply in + -- an instantiation: if the generic unit is legal so is + -- the instance. + if Nkind (Parent (Base_Type (Parent_Typ))) = N_Private_Type_Declaration or else Nkind (Parent (Base_Type (Parent_Typ))) = N_Private_Extension_Declaration then - if Nkind (N) /= N_Extension_Aggregate then + if Nkind (N) /= N_Extension_Aggregate + and then not In_Instance + then Error_Msg_NE ("type of aggregate has private ancestor&!", N, Parent_Typ); |