Legality Rules<3> (GNAT Reference Manual)

#### 18.3.14.2 Legality Rules ¶

The `name` in a `structural_generic_instance_name` shall denote a generic unit that is preelaborated. Note that, unlike in a traditional instantiation, there are no square brackets around the `generic_actual_part` in the second production, which means that it is mandatory and, therefore, that the generic unit shall have at least one generic formal parameter.

The generic unit shall not take a generic formal object of mode `in out`. If the generic unit takes a generic formal object of mode `in`, then the corresponding generic actual parameter shall be a static expression.

A `structural_generic_instance_name` for a generic package shall not be present in a library unit if the structural instance is also a library unit and has a semantic dependence on the former.

For a generic subprogram, if a local entity of the enclosing library-level package is used as an actual and the structural instance would have a semantic dependence on the package, the structural instantiation is automatically demoted to a local instantiation. In this case, several instances of the generic subprogram may be present in a single partition, unless whole-partition optimization is performed (e.g., via LTO).