https://gcc.gnu.org/g:bdb29aa4e543d47da6ebdc968b7bcff6ebae172b

commit r16-3695-gbdb29aa4e543d47da6ebdc968b7bcff6ebae172b
Author: Viljar Indus <[email protected]>
Date:   Fri Aug 1 09:28:13 2025 +0300

    ada: The policy of a generic can be different within a instantiation
    
    gcc/ada/ChangeLog:
    
            * ghost.adb (Check_Ghost_Policy): ignore ghost policy changes
            within instantiation statements.

Diff:
---
 gcc/ada/ghost.adb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb
index 6e843bda9577..31d171dee00c 100644
--- a/gcc/ada/ghost.adb
+++ b/gcc/ada/ghost.adb
@@ -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;

Reply via email to