The Ghost assertion policy relevant for analyzing a generic instantiation
is the Ghost policy at the point of instantiation, not the one applicable
for the generic itself.
gcc/ada/
* ghost.adb (Mark_And_Set_Ghost_Instantiation): Fix the current
Ghost policy for the instantiation.
elsif Ghost_Mode = Ignore then
Policy := Name_Ignore;
- -- Inherit the "ghostness" of the generic unit
+ -- Inherit the "ghostness" of the generic unit, but the current Ghost
+ -- policy is the relevant one for the instantiation.
- elsif Is_Checked_Ghost_Entity (Gen_Id) then
- Policy := Name_Check;
+ elsif Is_Checked_Ghost_Entity (Gen_Id)
+ or else Is_Ignored_Ghost_Entity (Gen_Id)
+ then
+ Policy := Policy_In_Effect (Name_Ghost);
- elsif Is_Ignored_Ghost_Entity (Gen_Id) then
- Policy := Name_Ignore;
+ if Policy = No_Name then
+ Policy := Name_Ignore;
+ end if;
end if;
-- Mark the instantiation as Ghost