aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch7.adb
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2020-07-05 06:43:30 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-10-19 05:53:35 -0400
commite40cb362d0b3d49e5dc5a68c5dec1d5672c2832a (patch)
tree0802e76de0447adca0883eefe20502f094849c69 /gcc/ada/sem_ch7.adb
parente335bd2e6ebc23050d48ad17584323f590733d50 (diff)
downloadgcc-e40cb362d0b3d49e5dc5a68c5dec1d5672c2832a.zip
gcc-e40cb362d0b3d49e5dc5a68c5dec1d5672c2832a.tar.gz
gcc-e40cb362d0b3d49e5dc5a68c5dec1d5672c2832a.tar.bz2
[Ada] Private type unexpectedly visible
gcc/ada/ * sem_ch7.adb (Uninstall_Declarations): Uninstall the declaration of a subtype declaration defined in the private part of a package.
Diffstat (limited to 'gcc/ada/sem_ch7.adb')
-rw-r--r--gcc/ada/sem_ch7.adb19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index b389464..04ff071 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -3185,6 +3185,25 @@ package body Sem_Ch7 is
end loop;
end;
+ -- For subtypes of private types the frontend generates two entities:
+ -- one associated with the partial view and the other associated with
+ -- the full view. When the subtype declaration is public the frontend
+ -- places the former entity in the list of public entities of the
+ -- package and the latter entity in the private part of the package.
+ -- When the subtype declaration is private it generates these two
+ -- entities but both are placed in the private part of the package
+ -- (and the full view has the same source location as the partial
+ -- view and no parent; see Prepare_Private_Subtype_Completion).
+
+ elsif Ekind (Id) in E_Private_Subtype
+ | E_Limited_Private_Subtype
+ and then Present (Full_View (Id))
+ and then Sloc (Id) = Sloc (Full_View (Id))
+ and then No (Parent (Full_View (Id)))
+ then
+ Set_Is_Hidden (Id);
+ Set_Is_Potentially_Use_Visible (Id, False);
+
elsif not Is_Child_Unit (Id)
and then (not Is_Private_Type (Id) or else No (Full_View (Id)))
then