aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-03-19 14:50:32 +0100
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:12:13 -0300
commit314d88307c2b9926e08d83681cdb2d0f3109253a (patch)
tree91012dd3af201e0eb6927bb6ec7379cedd33307c /gcc
parent2e02214f27b3e2c290326430aa7c3cbf78c41941 (diff)
downloadgcc-314d88307c2b9926e08d83681cdb2d0f3109253a.zip
gcc-314d88307c2b9926e08d83681cdb2d0f3109253a.tar.gz
gcc-314d88307c2b9926e08d83681cdb2d0f3109253a.tar.bz2
[Ada] Fix missing insertion of explicit dereference in instance
2020-06-11 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_res.adb (Resolve_Implicit_Dereference): In an instance, reset the type of the prefix if it is private before building the dereference.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_res.adb11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 71c9ed2..5fa74f0 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -8740,6 +8740,17 @@ package body Sem_Res is
Desig_Typ : Entity_Id;
begin
+ -- In an instance the proper view may not always be correct for
+ -- private types, see e.g. Sem_Type.Covers for similar handling.
+
+ if Is_Private_Type (Etype (P))
+ and then Present (Full_View (Etype (P)))
+ and then Is_Access_Type (Full_View (Etype (P)))
+ and then In_Instance
+ then
+ Set_Etype (P, Full_View (Etype (P)));
+ end if;
+
if Is_Access_Type (Etype (P)) then
Desig_Typ := Implicitly_Designated_Type (Etype (P));
Insert_Explicit_Dereference (P);