]> gcc.gnu.org Git - gcc.git/commitdiff
[Ada] Hang on generic declaration with ambiguous formal package
authorJustin Squirek <squirek@adacore.com>
Thu, 7 May 2020 11:26:59 +0000 (07:26 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 6 Jul 2020 11:35:10 +0000 (07:35 -0400)
gcc/ada/

* sem_ch12.adb (Analyze_Associations): Add check for errors on
the generic formal before continuing with instantiation.

gcc/ada/sem_ch12.adb

index ff8a15a016dda2c67ad279f8c6dbdf7f50fb191b..9865de4802efe88e3d5cbd3f27280be1ac20ccb2 100644 (file)
@@ -1948,10 +1948,19 @@ package body Sem_Ch12 is
                   end if;
 
                when N_Formal_Package_Declaration =>
-                  Match :=
-                    Matching_Actual
-                      (Defining_Identifier (Formal),
-                       Defining_Identifier (Original_Node (Analyzed_Formal)));
+                  --  The name of the formal package may be hidden by the
+                  --  formal parameter itself.
+
+                  if Error_Posted (Analyzed_Formal) then
+                     Abandon_Instantiation (Instantiation_Node);
+
+                  else
+                     Match :=
+                       Matching_Actual
+                         (Defining_Identifier (Formal),
+                          Defining_Identifier
+                            (Original_Node (Analyzed_Formal)));
+                  end if;
 
                   if No (Match) then
                      if Partial_Parameterization then
This page took 0.085276 seconds and 5 git commands to generate.