[Ada] Errors on globals in expressions of predicate aspects in generic bodies
Pierre-Marie de Rodat
Tue Nov 9 09:45:50 GMT 2021
When a predicate aspect is given on a declaration inside of a generic
body and the expression of the aspect references entities declared
outside of the generic, errors about those entities not being defined
can be issued in instantiations of the generic. This happens because the
expression of the Predicate pragma created for the aspect is not
analyzed before the global references are captured by
Save_Global_References. The pragma expression is now analyzed when the
declaration is frozen in the generic.
Tested on x86_64-pc-linux-gnu, committed on trunk
* sem_ch13.adb (Freeze_Entity_Checks): Analyze the expression of
a pragma Predicate associated with an aspect at the freeze point
of the type, to ensure that references to globals get saved when
the aspect occurs within a generic body. Also, add
Aspect_Static_Predicate to the choices of the membership test of
the enclosing guard.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2227 bytes
Desc: not available
More information about the Gcc-patches