3 -- Grant of Unlimited Rights
5 -- The Ada Conformity Assessment Authority (ACAA) holds unlimited
6 -- rights in the software and documentation contained herein. Unlimited
7 -- rights are the same as those granted by the U.S. Government for older
8 -- parts of the Ada Conformity Assessment Test Suite, and are defined
9 -- in DFAR 252.227-7013(a)(19). By making this public release, the ACAA
10 -- intends to confer upon all recipients unlimited rights equal to those
11 -- held by the ACAA. These rights include rights to use, duplicate,
12 -- release or disclose the released technical data and computer software
13 -- in whole or in part, in any manner and for any purpose whatsoever, and
14 -- to have or permit others to do so.
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19 -- DISCLOSED ARE AS IS. THE ACAA MAKES NO EXPRESS OR IMPLIED
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
27 -- Check that per-object expressions are evaluated as specified for
28 -- protected components. (Defect Report 8652/0002, as reflected in
29 -- Technical Corrigendum 1, RM95 3.6(22/1) and 3.8(18/1)).
32 -- 9 FEB 2001 PHL Initial version.
33 -- 29 JUN 2002 RLB Readied for release.
40 subtype Sm
is Integer range 1 .. 10;
42 type Rec
(D1
, D2
: Sm
) is
49 "Check compatibility of discriminant expressions" &
50 " when the constraint depends on discriminants, " &
51 "and the discriminants have defaults - protected components");
54 protected type Cons
(D3
: Integer := Ident_Int
(11)) is
55 function C1_D1
return Integer;
56 function C1_D2
return Integer;
60 protected body Cons
is
61 function C1_D1
return Integer is
65 function C1_D2
return Integer is
72 (C
: Cons
; D3
: Integer; C1_D1
: Integer; C1_D2
: Integer)
75 return C
.D3
= D3
and C
.C1_D1
= C1_D1
and C
.C1_D2
= C1_D2
;
83 Failed
("Discriminant check not performed - 1");
84 if not Is_Ok
(X
, 1, 1, 1) then
85 Comment
("Shouldn't get here");
89 when Constraint_Error
=>
92 Failed
("Unexpected exception - 1");
97 type Acc_Cons
is access Cons
;
101 Failed
("Discriminant check not performed - 2");
103 if not Is_Ok
(X
.all, 1, 1, 1) then
104 Comment
("Irrelevant");
108 when Constraint_Error
=>
111 Failed
("Unexpected exception raised - 2");
115 Failed
("Constraint checked too soon - 2");
120 subtype Scons
is Cons
;
125 Failed
("Discriminant check not performed - 3");
126 if not Is_Ok
(X
, 1, 1, 1) then
127 Comment
("Irrelevant");
131 when Constraint_Error
=>
134 Failed
("Unexpected exception raised - 3");
138 Failed
("Constraint checked too soon - 3");
143 type Arr
is array (1 .. 5) of Cons
;
148 Failed
("Discriminant check not performed - 4");
149 for I
in Arr
'Range loop
150 if not Is_Ok
(X
(I
), 1, 1, 1) then
151 Comment
("Irrelevant");
156 when Constraint_Error
=>
159 Failed
("Unexpected exception raised - 4");
163 Failed
("Constraint checked too soon - 4");
176 Failed
("Discriminant check not performed - 5");
177 if not Is_Ok
(X
.C1
, 1, 1, 1) then
178 Comment
("Irrelevant");
182 when Constraint_Error
=>
185 Failed
("Unexpected exception raised - 5");
189 Failed
("Constraint checked too soon - 5");
194 type Drec
is new Cons
;
199 Failed
("Discriminant check not performed - 6");
200 if not Is_Ok
(Cons
(X
), 1, 1, 1) then
201 Comment
("Irrelevant");
205 when Constraint_Error
=>
208 Failed
("Unexpected exception raised - 6");
212 Failed
("Constraint checked too soon - 6");
221 Failed
("Constraint check done too early");