Version 1.1 of ais/ai-00168.txt

Unformatted version of ais/ai-00168.txt version 1.1
Other versions for file ais/ai-00168.txt

!standard 04.06 (00)          96-11-16 AI95-00168/00
!class binding interpretation 96-11-16
!status received 96-11-16
!priority Medium
!difficulty Easy
!subject Aliased objects can have discriminants modified
!summary 96-11-16
!question 96-11-16
!recommendation 96-11-16
!wording 96-11-16
!discussion 96-11-16

!section 4.6(00)
!subject Aliased objects can have discriminants modified
!reference RM95-4.6
!reference RM95-6.4.1 (16,17)
!from Stephen Michell 96-10-12
!keywords constrained object aliased change of discriminat
!reference 96-5720.a Steve Michell 96-10-12>>

Consider the following code fragment

       procedure acc_cvt2 is
         package P is
           type T is private;
           a: constant T;
           b: constant T;
           type T( X: integer := 0 ) is null record;
           a: constant T := ( X => 1 );
           b: constant T := ( X => 2 );
         end P;
         type A is array( 1 .. 10) of aliased P.T;
         type B is array( 1 .. 10) of P.T;
         X : A := (1..10 => P.a);
         procedure Q( Y : in out B ) is
           Y(1) := P.B;
         end Q;
       end ACC_CVT2;

Object X is constrained because it is an array of aliased records, even
though unaliased objects of such a type would be unconstrained. The call
Q(B(X)) is a view conversion by 4.6(5). The remaining rules in 4.6
do not appear to cover the case shown above, but it appears that a view
conversion between an unconstrained and constrained view of an object
should be illegal.


Questions? Ask the ACAA Technical Agent