Version 1.1 of ai05s/ai05-0276-1.txt
!standard 3.2.4(0) 11-11-12 AI05-0276-1/01
!class Amendment 11-11-12
!status Amendment 2012 11-11-12
!status ARG Approved 8-0-1 11-11-12
!status work item 11-11-12
!status received 11-11-12
!priority Low
!difficulty Easy
!qualifier Error
!subject Violation of predicate legality rules in generic units
!summary
Program_Error is raised at the point of the violation of a Legality Rule
involving predicates in a generic instance (body).
!proposal
The wording of 3.2.4(23/3) says that Program_Error is raised if a legality
rule is violated in a generic instance, but saying nothing about where that
exception is raised. This should be clarified.
!wording
Replace 3.2.4(23/3) by:
If any of the above Legality Rules is violated in an instance of
a generic unit, Program_Error is raised at the point of the violation.
!discussion
This rule is intended to work much like the accessibility checks that occur
in instance bodies. Those raise Program_Error at the point of the violation;
these might as well do the same.
We considered raising Program_Error in the instance instead (or optionally).
This is slightly better in the sense it is less likely that the error would be
missed (as could happen if the code involved is never executed). OTOH, if the
code is never executed, what is the harm in ignoring the error? In addition,
we could not find a reasonable point in the instance to require the exception
to be raised: it depends solely on the contents of the body and it seems strange
to require the elaboration of the instance specification to raise an exception
for that reason.
!corrigendum 3.2.4(0)
Insert new clause:
Force a conflict; the real wording is found in the conflict file.
!ACATS Test
None needed.
!ASIS
No change needed.
!appendix
From: John Barnes
Sent: Saturday, November 12, 2011 3:23 PM
First, Last and Range are not available if a type has subtype predicates.
Does this mean that such a type cannot be used as an actual generic parameter
for a discrete type. The body might use First etc.
I cannot find a rule that says this
****************************************************************
From: Steve Baird
Sent: Saturday, November 12, 2011 4:06 PM
I think this is addressed by combining the following two rules:
3.2.4(16/3):
The prefix of an attribute_reference whose attribute_designator is
First, Last, or Range shall not denote a scalar subtype to which
predicate specifications apply.
3.2.4(23/3)):
If any of the above Legality Rules is violated in an instance of a
generic unit, Program_Error is raised.
The precise point at which the exception is raised is perhaps not obvious from
this wording, but that seems like a separate question.
****************************************************************
From: Steve Baird
Sent: Saturday, November 12, 2011 4:46 PM
Replace 3.2.4(23/3)
If any of the above Legality Rules is violated in an instance of
a generic unit, Program_Error is raise.
with either
If any of the above Legality Rules is violated in an instance of
a generic unit, Program_Error is raised. Program_Error is raised
either at the point of the violation or at some point during the
elaboration of the instance no later than the start of the
elaboration of the instance body.
or perhaps
If any of the above Legality Rules is violated in an instance of
a generic unit, Program_Error is raised at the point of the
violation.
Implementation Permissions
If any of the above Legality_Rules is violated in an instance of
a generic unit, Program_Error may be raised at some point
during the elaboration of the instance no later than the
start of the elaboration of the instance body.
****************************************************************
Editor's note: The contents of this AI were decided late on
Saturday, November 12, 2011 during the Denver ARG meeting (#45).
Following is the important part of the (draft) minutes of that
meeting:
We discuss why there isn't stronger approval of this AI. Several people
say that they don't like the indecision; it doesn't seem that it buys much.
They especially don't like "at some point during the elaboration".
If we only go with a single option, which one should we chose? Randy would
prefer that the exception is raised at the point of the violation. It's
easier to implement in his shared generic implementation (the instance does
not know the contents of the body). He also notes that it is consistent with
the way that accessibility checks are handled.
The group agrees with his logic. So just add "...at the point of the violation."
at the end of the existing wording.
****************************************************************
Questions? Ask the ACAA Technical Agent