From ce16f54f6edf9c440046f6dd454e1dcbbb1ffae3 Mon Sep 17 00:00:00 2001 From: Justin Squirek Date: Thu, 7 May 2020 07:26:59 -0400 Subject: [PATCH] [Ada] Hang on generic declaration with ambiguous formal package gcc/ada/ * sem_ch12.adb (Analyze_Associations): Add check for errors on the generic formal before continuing with instantiation. --- gcc/ada/sem_ch12.adb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index ff8a15a016d..9865de4802e 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -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 -- 2.30.2