[Ada] Spurious error on instantiations with Taft_Amendment types and tasks
authorEd Schonberg <schonberg@adacore.com>
Mon, 24 Feb 2020 18:37:58 +0000 (13:37 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 9 Jun 2020 08:09:00 +0000 (04:09 -0400)
2020-06-09  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* exp_ch9.adb (Build_Master_Renaming): Make name in renaming
declaration unique by adding a numeric suffix, to prevent
accidental name conflict when several instantiations of a
package containing an access_to_incomplete type that designate
tasks appear in the same scope.

gcc/ada/exp_ch9.adb

index 36baf6f..2efa6d1 100644 (file)
@@ -3469,10 +3469,13 @@ package body Exp_Ch9 is
 
       --  Generate:
       --    <Ptr_Typ>M : Master_Id renames _Master;
+      --  and add a numeric suffix to the name to ensure that it is
+      --  unique in case other access types in nested constructs
+      --  are homonyms of this one.
 
       Master_Id :=
         Make_Defining_Identifier (Loc,
-          New_External_Name (Chars (Ptr_Typ), 'M'));
+          New_External_Name (Chars (Ptr_Typ), 'M', -1));
 
       Master_Decl :=
         Make_Object_Renaming_Declaration (Loc,