]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix nested generic instantiation
authorMarc Poulhiès <poulhies@adacore.com>
Wed, 21 Dec 2022 09:29:38 +0000 (10:29 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 5 Jan 2023 14:30:01 +0000 (15:30 +0100)
Previous fix for generic instantiation was not precise enough and could
wrongly assume the instantiation node to be an N_Expanded_Name.

gcc/ada/

* sem_ch12.adb (Instantiate_Package_Body): Better filtering when
installing parent on the scope stack.

gcc/ada/sem_ch12.adb

index 0f2dd39b53cfa500d78c5f18673715c598b1566a..1755549bd8b9780d457abe4d6c0be35adc9c067b 100644 (file)
@@ -12182,6 +12182,9 @@ package body Sem_Ch12 is
          elsif Ekind (Scope (Gen_Unit)) = E_Generic_Package
            and then Ekind (Scope (Act_Decl_Id)) = E_Package
            and then Is_Generic_Instance (Scope (Act_Decl_Id))
+           and then Nkind
+             (Name (Get_Unit_Instantiation_Node
+                      (Scope (Act_Decl_Id)))) = N_Expanded_Name
          then
             Par_Ent := Entity
               (Prefix (Name (Get_Unit_Instantiation_Node