public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2013] [Ada] Spurious error in instantiation with aggregate and private ancestor
@ 2021-07-05 13:13 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-05 13:13 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0b8880428c4da92886b069af714365019f660ade

commit r12-2013-g0b8880428c4da92886b069af714365019f660ade
Author: Ed Schonberg <schonberg@adacore.com>
Date:   Mon Apr 26 13:32:06 2021 -0400

    [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.

Diff:
---
 gcc/ada/sem_aggr.adb | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index d189ab7682d..9ad96296dd4 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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-05 13:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 13:13 [gcc r12-2013] [Ada] Spurious error in instantiation with aggregate and private ancestor Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).