From 695a27fbb77c02fedb946c8c8349f108629bd45f Mon Sep 17 00:00:00 2001 From: Justin Squirek Date: Thu, 19 Mar 2020 16:59:30 -0400 Subject: [PATCH] [Ada] Missing accessibility error on object in type conversion 2020-06-12 Justin Squirek gcc/ada/ * sem_util.adb (Object_Access_Level): Add processing of implicit dereferences. --- gcc/ada/sem_util.adb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 207d9d23ba1..3ae82645ffb 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -23697,12 +23697,23 @@ package body Sem_Util is -- Local variables E : Entity_Id; - Orig_Obj : constant Node_Id := Original_Node (Obj); + Orig_Obj : Node_Id := Original_Node (Obj); Orig_Pre : Node_Id; -- Start of processing for Object_Access_Level begin + -- In the case of an expanded implicit dereference we swap the original + -- object to be the expanded conversion. + + if Nkind (Obj) = N_Explicit_Dereference + and then Nkind (Orig_Obj) /= N_Explicit_Dereference + then + Orig_Obj := Obj; + end if; + + -- Calculate the object node's accessibility level + if Nkind (Orig_Obj) = N_Defining_Identifier or else Is_Entity_Name (Orig_Obj) then -- 2.30.2