Version 1.1 of ai12s/ai12-0137-1.txt

Unformatted version of ai12s/ai12-0137-1.txt version 1.1
Other versions for file ai12s/ai12-0137-1.txt

!standard 3.10.1(2.2/2)          14-10-10 AI05-0137-1/01
!class binding interpretation 14-10-10
!status work item 14-10-10
!status received 14-08-26
!priority Low
!difficulty Medium
!qualifier Clarification
!subject 3.10.1 and class-wide types
!summary
3.10.1(2.2-2.6) apply to access-to-class-wide types.
!question
3.10.1(2.2-2.6) says:
Given an access type A whose designated type T is an incomplete view, a dereference of a value of type A also has this incomplete view except when:
* it occurs within the immediate scope of the completion of T, or
* it occurs within the scope of a nonlimited_with_clause that mentions a library package in whose visible part the completion of T is declared, or
* it occurs within the scope of the completion of T and T is an incomplete view declared by an incomplete_type_declaration.
In these cases, the dereference has the view of T visible at the point of the dereference.
Does this apply to an access-to-class-wide type? (Yes.) A class-wide type does not have a declaration, an incomplete view, or a completion.
!recommendation
(See Summary.)
!wording
Replace 3.10.1(2.2/2) with:
Given an access type A whose designated type T is an incomplete view, or whose designated type is T'Class where T is an incomplete view, a dereference of a value of type A also has this incomplete view except when:
[This is Adam's suggestion; I don't think it works - RLB.]
!discussion
The question notes that a class-wide type does not have an incompelete view, because it doesn't have a declaration, and thus 10.1.1(12.3/3) does not apply to it. This strikes the author as a bug, in that a class-wide type should mirror its associated specific type as closely as possible.
Indeed, there doesn't seem to be any general rule about properties of specific types being associated with the class-wide type. 3.4.1(4-5) talks about components and values. 7.5(5/3) extended limitedness. There probably are a few additional explicitly spelled out rules.
Clearly, 3.10.1(2.2-2.6/2) should apply here. The proposed wording looks simple, but it has a fatal flaw: it says that a dereference of A has "this incomplete view", but we started out saying that a class-wide type never has an incomplete view. So what incomplete view are we talking about here? The incomplete view of the specific type has the wrong type, so it better not be that.
Thus it seems that to make this wording work at all, a class-wide type needs to have an incomplete view whenever the associated specific type has one. That looks like a enough of a can of worms that I gave up at this point.
!ASIS
No ASIS effect.
!ACATS test
We might need a ACATS C-Test to verify that access-to-classwide types can be used as complete if the corresponding access-to-tagged can be used as complete.
!appendix

!topic 3.10.1 and class-wide types
!reference RM12 3.10.1(2.2/2-2.6/3)
!from Adam Beneschan 14-08-26
!discussion

This one just looks like a minor wording problem to me.
3.10.1(2.2-2.6) says:

-------------------------------------------------------------------------------
Given an access type A whose designated type T is an incomplete view, a
dereference of a value of type A also has this incomplete view except when:

  it occurs within the immediate scope of the completion of T, or

  it occurs within the scope of a nonlimited_with_clause that mentions a
  library package in whose visible part the completion of T is declared,

or

  it occurs within the scope of the completion of T and T is an
  incomplete view declared by an incomplete_type_declaration.
  
In these cases, the dereference has the view of T visible at the point of the
dereference. 
-------------------------------------------------------------------------------

It is not clear to me that this applies to access-to-classwide types, as written,
although it should apply.  As far as I can tell, a classwide type does not have
a declaration, an incomplete view, or a completion.  Perhaps the first sentence
should be

    Given an access type A whose designated type T is an incomplete
    view, or whose designated type is T'Class where T is an incomplete
    view, a dereference of a value of type A also has this incomplete
    view except when: ...

Maybe there's somewhere else in the RM that covers this, but I haven't found it.

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

Questions? Ask the ACAA Technical Agent