]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Spurious accessibility error on allocator
authorJustin Squirek <squirek@adacore.com>
Fri, 29 May 2020 19:44:50 +0000 (15:44 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 15 Jul 2020 13:42:34 +0000 (09:42 -0400)
gcc/ada/

* exp_ch6.adb (Make_Build_In_Place_Call_Allocator): Normalize
the associated node for internally generated objects to be like
their SOAAT counter-parts.

gcc/ada/exp_ch6.adb

index a42bd25709ddb128227efd226aec8399f9dd69a5..bb9b150f6a07bd418c3c90299568e43ba66a417b 100644 (file)
@@ -9732,6 +9732,12 @@ package body Exp_Ch6 is
                     New_Occurrence_Of (Etype (BIP_Func_Call), Loc),
                   Expression   => New_Copy_Tree (BIP_Func_Call))));
 
+      --  Manually set the associated node for the anonymous access type to
+      --  be its local declaration to avoid confusing and complicating
+      --  the accessibility machinary.
+
+      Set_Associated_Node_For_Itype (Anon_Type, Tmp_Decl);
+
       Expander_Mode_Save_And_Set (False);
       Insert_Action (Allocator, Tmp_Decl);
       Expander_Mode_Restore;