public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Marc Poulhi?s <dkm@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-2124] ada: Plug another loophole in the handling of private views in instances Date: Tue, 27 Jun 2023 12:07:40 +0000 (GMT) [thread overview] Message-ID: <20230627120740.BECBD385840D@sourceware.org> (raw) https://gcc.gnu.org/g:125a2260ce07e384238f8569c77d07c56762d39c commit r14-2124-g125a2260ce07e384238f8569c77d07c56762d39c Author: Eric Botcazou <ebotcazou@adacore.com> Date: Mon Jun 12 12:36:56 2023 +0200 ada: Plug another loophole in the handling of private views in instances This deals with discriminants of types declared in package bodies. gcc/ada/ * sem_ch12.adb (Check_Private_View): Also check the type of visible discriminants in record and concurrent types. Diff: --- gcc/ada/sem_ch12.adb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index d5280cea712..fbfc2db7f9a 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -7710,6 +7710,9 @@ package body Sem_Ch12 is Prepend_Elmt (Typ, Exchanged_Views); Exchange_Declarations (Etype (Get_Associated_Node (N))); + -- Check that the available views of Typ match their respective flag. + -- Note that the type of a visible discriminant is never private. + else Check_Private_Type (Typ, Has_Private_View (N)); @@ -7720,6 +7723,20 @@ package body Sem_Ch12 is elsif Is_Array_Type (Typ) then Check_Private_Type (Component_Type (Typ), Has_Secondary_Private_View (N)); + + elsif (Is_Record_Type (Typ) or else Is_Concurrent_Type (Typ)) + and then Has_Discriminants (Typ) + then + declare + Disc : Entity_Id; + + begin + Disc := First_Discriminant (Typ); + while Present (Disc) loop + Check_Private_Type (Etype (Disc), False); + Next_Discriminant (Disc); + end loop; + end; end if; end if; end if;
reply other threads:[~2023-06-27 12:07 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230627120740.BECBD385840D@sourceware.org \ --to=dkm@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).