When a formal generic type is marked as Ghost, the instantiation of that
generic will contain a generic subtype for the actual with the Ghost
pragma. Recognize this case.
gcc/ada/
* sem_prag.adb (Analyze_Pragma): Recognize a generated subtype
with Ghost pragma for generic instantiations.
then
Id := Defining_Entity (Stmt);
exit;
+
+ -- When pragma Ghost applies to a generic formal type, the
+ -- type declaration in the instantiation is a generated
+ -- subtype declaration.
+
+ elsif Nkind (Stmt) = N_Subtype_Declaration
+ and then Present (Generic_Parent_Type (Stmt))
+ then
+ Id := Defining_Entity (Stmt);
+ exit;
end if;
-- The pragma applies to a legal construct, stop the traversal