Version 1.2 of ai05s/ai05-0237-1.txt

Unformatted version of ai05s/ai05-0237-1.txt version 1.2
Other versions for file ai05s/ai05-0237-1.txt

!standard 12.5.1(5.1/2)          11-03-11 AI05-0237-1/02
!class binding interpretation 11-01-30
!status Amendment 2012 11-03-11
!status ARG Approved 7-0-1 10-02-20
!status work item 11-01-30
!status received 10-07-14
!priority Low
!difficulty Easy
!qualifier Omission
!subject Ancestor types for synchronized formal types
!summary
The ancestor type for a synchronized formal derived type must be a limited interface.
!question
There appears to be no rule forbidding a declaration like:
generic type T is synchronized new Record_Type and Interface_Type with private;
But the actual type for synchronized type has to be a task type, protected type, or a synchronized interface. A record type is not allowed. Should this be fixed? (Yes.)
!recommendation
(See Summary.)
!wording
Modify 12.5.1(5/2):
... The reserved word limited or synchronized shall appear only if the ancestor type Redundant[and any progenitor types] are limited types. The reserved word synchronized shall appear (rather than limited) if the ancestor type or any of the progenitor types are synchronized interfaces. {The ancestor type shall be a limited interface if the reserved word synchonized appears.}
!discussion
Even without any changes, any instantiation of such a generic would necessarily fail. But that seems silly; the error should be diagnosed earlier rather than later.
Moreover, the similar case for private extensions is illegal by 7.3(8.1/2). Generally, we want to rules for generic formal types to mirror the rules for private types. So we add wording to make this illegal.
!corrigendum 12.5.1(5/2)
Replace the paragraph:
The ancestor subtype of a formal derived type is the subtype denoted by the subtype_mark of the formal_derived_type_definition. For a formal derived type declaration, the reserved words with private shall appear if and only if the ancestor type is a tagged type; in this case the formal derived type is a private extension of the ancestor type and the ancestor shall not be a class-wide type. Similarly, an interface_list or the optional reserved words abstract or synchronized shall appear only if the ancestor type is a tagged type. The reserved word limited or synchronized shall appear only if the ancestor type and any progenitor types are limited types. The reserved word synchronized shall appear (rather than limited) if the ancestor type or any of the progenitor types are synchronized interfaces.
by:
The ancestor subtype of a formal derived type is the subtype denoted by the subtype_mark of the formal_derived_type_definition. For a formal derived type declaration, the reserved words with private shall appear if and only if the ancestor type is a tagged type; in this case the formal derived type is a private extension of the ancestor type and the ancestor shall not be a class-wide type. Similarly, an interface_list or the optional reserved words abstract or synchronized shall appear only if the ancestor type is a tagged type. The reserved word limited or synchronized shall appear only if the ancestor type and any progenitor types are limited types. The reserved word synchronized shall appear (rather than limited) if the ancestor type or any of the progenitor types are synchronized interfaces. The ancestor type shall be a limited interface if the reserved word synchonized appears.
!ACATS test
Add an ACATS B-test to check this issue.
!appendix

!topic Synchronized formal types derived from records?
!reference RM05 12.5.1
!from Adam Beneschan 10-07-14
!discussion

I think this is an error of omission:  Nothing prevents a declaration like 

   generic
      type T is synchronized new Record_Type and Interface_Type with private;

even though this makes no sense---a synchronized type is a task or protected type
and can't be derived from a record.  The error is probably harmless since such a
generic can't be instantiated anyway, but it certainly seems like this ought
to be illegal.

****************************************************************


Questions? Ask the ACAA Technical Agent