Version 1.1 of ai05s/ai05-0106-1.txt
!standard 13.14(3/1) 08-07-08 AI05-0106-1/01
!class binding interpretation 08-06-15
!status work item 08-07-08
!status received 06-06-21
!priority Low
!difficulty Easy
!qualifier Omission
!subject Representation items are not allowed on generic formal parameters
!summary
Representation items are not allowed on generic formal parameters.
!question
Consider:
generic
type T is new Some_Tagged with private;
pragma Independent_Components (T);
package G is ...
This appears to be legal, as 13.1(10) does not apply, and T is considered to be
a record type. But what does it mean? Does it put a restriction on the
actual types in an instance? (No, it is illegal.)
!recommendation
(See summary.)
!wording
Add after 13.14(3/1):
A generic formal parameter is always considered frozen.
AARM Ramification: This means that no operational or representation items are allowed on
a generic formal type. But this does not freeze the profile of a generic formal subprogram
or the index subtype of a formal array type.
!discussion
Most representation items are illegal on a formal type, as they require a first subtype
(and a generic formal type is not a first subtype). However, the pragmas in C.6 have
other requirements. Not all of them disallow formal types.
One possible fix would be to rewrite the resolution rules in C.6 to exclude formal types.
But this seems tricky and unnecessary.
Another approach would be to explicitly disallow representation pragmas from formal
parts. But this feels like an arbitrary rule.
Thus, we specify that generic formal types are always
considered to be frozen (their actual type will always be frozen in any instance, as
the instance freezes everything -- 13.14(5)).
--!corrigendum 13.14(3/1)
!ACATS Test
An ACATS B-Test should be created to check that this is illegal. (Probably
just add cases to the existing tests.)
!appendix
****************************************************************
Questions? Ask the ACAA Technical Agent