Version 1.1 of acs/ac-00188.txt

Unformatted version of acs/ac-00188.txt version 1.1
Other versions for file acs/ac-00188.txt

!standard 3.8(12)          10-02-13 AC95-00188/01
!class confirmation 10-02-13
!status received no action 10-02-13
!status received 09-11-30
!subject References to prior discriminants in discriminant part?

!topic References to prior discriminants in discriminant part?
!reference 3.7
!from Adam Beneschan 09-11-30

In this example:

    package Pack1 is
        type Rec is record
            F1 : Integer;
        end record;
        procedure Proc (Param1 : Rec;  Param2 : Integer := Param1.F1);
    end Pack1;

There's nothing in the visibility rules that makes Param1 hidden in the
declaration of parameter Param2.  But a special rule in 6.1(21) makes this use

But I don't see a similar rule for discriminant parts:

    package Pack1 is
        type Rec is record
            F1 : Integer;
        end record;
        type Rec2 (Disc1 : access Rec := null;
                   Disc2 : Integer := Disc1.F1) is limited record
            S : String (1 .. Disc2);
        end record;
    end Pack1;

Is this legal?  (Not that it would be useful even if it were legal, since you
can't provide an explicit value for Disc1 in a discriminant constraint, without
also providing one for Disc2.)


From: Gary Dismukes
Date: Monday, November 30, 2009  5:28 PM

See the first sentence of 3.8(12):

   12  A name that denotes a noninherited discriminant is allowed within
       the declaration of the type, but not within the discriminant_
       part.  If the discriminant is used to define the constraint of a
       component, the bounds of an entry family, or the constraint of
       the parent subtype in a derived_type_definition then its name
       shall appear alone as a direct_name (not as part of a larger
       expression or expanded name).


From: Adam Beneschan
Date: Monday, November 30, 2009  5:35 PM

Silly me, for figuring a rule about discriminant parts belongs in the section on
discriminant parts.  Since tasks and protected types can have discriminant
parts, and this rule applies to them too, what is this rule doing in the "Record
Types" section???

Oh, well, I shouldn't complain too much.  The surrounding text has some rules
about components that aren't necessarily discriminants, and since there's no
separate section for "Composite Types" I guess there isn't a particularly good
place for it.  Anyway, that settles my question.  Thanks for directing me to the
correct spot, Gary.


From: Christoph Grein
Date: Tuesday, December  1, 2009 12:17 AM

RM 3.8(10..12) makes this illegal, I would think.


Questions? Ask the ACAA Technical Agent