Version 1.2 of ai05s/ai05-0134-1.txt
!standard 6.3.1(18) 09-03-09 AI05-0134-1/02
!class binding interpretation 09-01-24
!status Amendment 201Z 09-03-09
!status ARG Approved 9-0-0 09-02-21
!status work item 09-01-24
!status received 08-12-19
!priority Low
!difficulty Easy
!qualifier Omission
!subject Full conformance should include the profiles of anonymous access-to-subprogram parameters
!summary
When full conformance is required, the profiles of any access-to-subprogram parameters or results
also must fully conform.
!question
Is this legal? (No.)
package Pack1 is
procedure Proc (X : Integer;
Y : access procedure
(Param : Integer;
Flag : Boolean := True));
end Pack1;
package body Pack1 is
procedure Proc (X : Integer;
Y : access procedure
(Param : Integer;
Flag : Boolean := False)) is
...
end Proc;
end Pack1;
The wording for full conformance in 6.3.1(18) does not include any wording requiring the
profiles for access-to-subprogram parameters to be fully conformant.
!recommendation
(See Summary.)
!wording
Modify 6.3.1(18): [Note: The wording change of AI005-0046-1 is included here.]
Two profiles are fully conformant if they are subtype-conformant, and corresponding
parameters have the same names{,}[ and] both or neither have null_exclusions{,}[ and]
they have default_expressions that are fully conformant with one another{ and, for
access-to-subprogram parameters or access-to-subprogram results, the designated
profiles are fully conformant}.
!discussion
We could have simply said that "corresponding parameters" includes those in
access-to-subprogram parameters and results. But that would be inconsistent with the
rules for type conformance and mode conformance, which explicitly make requirements
on access parameters and results. So we add wording to cover those cases explicitly.
Note that without this rule, the default expressions could be different in an
access-to-subprogram parameter in the specification and body of a subprogram. In that
case, which default expression would be used in a call would be undefined. That would
be bad.
!corrigendum 6.3.1(18)
Replace the paragraph:
Two profiles are fully conformant if they are subtype-conformant, and corresponding
parameters have the same names and default_expressions that are fully conformant with
one another.
by:
Two profiles are fully conformant if they are subtype-conformant, and corresponding
parameters have the same names, both or neither have null_exclusions,
they have default_expressions that are fully conformant with one another and, for
access-to-subprogram parameters or access-to-subprogram results, the designated
profiles are fully conformant.
!ACATS Test
Add an ACATS B-Test to test cases similar to that in the question.
!appendix
!topic Profile conformance and access-subprogram parameters
!reference 6.3.1(15-18)
!from Adam Beneschan 08-12-19
!discussion
Is this legal?
package Pack1 is
procedure Proc (X : Integer;
Y : access procedure
(Param : Integer;
Flag : Boolean := True));
end Pack1;
package body Pack1 is
procedure Proc (X : Integer;
Y : access procedure
(Param : Integer;
Flag : Boolean := False)) is
...
end Proc;
end Pack1;
I'm not sure whether the RM says so or not. The profile on the body of Proc
has to be fully conformant.
"Two profiles are fully conformant if they are subtype-conformant, and corresponding
parameters have the same names and have default_expressions that are fully conformant
with one another."
In paragraph 15, it says that for two profiles to be type-conformant, the profiles of
any access-subprogram parameters have to be type-conformant. In paragraph 16, it says
that for two profiles to be mode-conformant, the profiles of any access-subprogram
parameters have to be subtype-conformant.
But there's nothing similar for full conformance. Full conformance implies subtype
conformance, so the profiles of access-subprogram parameters have to be subtype-conformant.
But nothing explicitly requires those profiles to be fully conformant, which means that
the above example should be legal unless "corresponding parameters" in 6.3.1(18) is
interpreted refer to corresponding parameters of access-subprogram parameter profiles
rather than just to the parameters of the profiles for which "full conformance" is
being questioned. And I don't see anything in the RM that would clarify that
"corresponding parameters" means just one or the other.
What's the intent?
****************************************************************
Questions? Ask the ACAA Technical Agent