* [COMMITTED] ada: Plug another loophole in the handling of private views in instances
@ 2023-06-27 12:08 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-06-27 12:08 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
From: Eric Botcazou <ebotcazou@adacore.com>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
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;
--
2.40.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-27 12:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27 12:08 [COMMITTED] ada: Plug another loophole in the handling of private views in instances Marc Poulhiès
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).