]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: The policy of a generic can be different within a instantiation
authorViljar Indus <indus@adacore.com>
Fri, 1 Aug 2025 06:28:13 +0000 (09:28 +0300)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 9 Sep 2025 12:39:54 +0000 (14:39 +0200)
gcc/ada/ChangeLog:

* ghost.adb (Check_Ghost_Policy): ignore ghost policy changes
within instantiation statements.

gcc/ada/ghost.adb

index 6e843bda9577d6e8a01c4d73b932eaa104418cbb..31d171dee00cce9e0f9d05c3374359bc3b86293d 100644 (file)
@@ -843,12 +843,14 @@ package body Ghost is
          Applic_Policy : Ghost_Mode_Type := Ghost_Config.Ghost_Mode;
          Ghost_Region  : constant Node_Id := Ghost_Config.Current_Region;
       begin
-         --  Ghost entities can be referenced inside a renaming declaration if
-         --  used within a renaming declaration.
+         --  The policy is allowed to change within renaming and instantiation
+         --  statements.
 
          if No (Ghost_Region)
            or else Nkind (Ghost_Region)
                    in N_Object_Renaming_Declaration
+                    | N_Package_Instantiation
+                    | N_Procedure_Instantiation
                     | N_Subprogram_Renaming_Declaration
          then
             return;