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 GOVERNMENT 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 objects designated by X'Access (where X is of a class-wide
28 -- type) and new T'Class'(...) are dynamically tagged and can be used in
29 -- dispatching calls. (Defect Report 8652/0010).
32 -- 18 JAN 2001 PHL Initial version
33 -- 15 MAR 2001 RLB Readied for release.
34 -- 03 JUN 2004 RLB Removed constraint for S0, as the subtype has
35 -- unknown discriminants.
40 type T
(D
: Integer) is abstract tagged private;
42 procedure P
(X
: access T
) is abstract;
43 function Create
(X
: Integer) return T
'Class;
45 Result
: Natural := 0;
48 type T
(D
: Integer) is abstract tagged null record;
53 type T
is new C392014_0
.T
with private;
54 function Create
(X
: Integer) return T
'Class;
56 type T
is new C392014_0
.T
with
60 procedure P
(X
: access T
);
63 package C392014_1
.Child
is
64 type T
is new C392014_1
.T
with private;
65 procedure P
(X
: access T
);
66 function Create
(X
: Integer) return T
'Class;
68 type T
is new C392014_1
.T
with
77 package body C392014_1
is
79 procedure P
(X
: access T
) is
81 C392014_0
.Result
:= C392014_0
.Result
+ X
.D
+ X
.C1
;
84 function Create
(X
: Integer) return T
'Class is
86 case X
mod Ident_Int
(2) is
88 return C392014_1
.Child
.Create
(X
/ Ident_Int
(2));
91 Y
: T
(D
=> (X
/ Ident_Int
(2)) mod Ident_Int
(20));
93 Y
.C1
:= X
/ Ident_Int
(40);
106 type T
is new C392014_0
.T
with private;
107 function Create
(X
: Integer) return T
'Class;
109 type T
is new C392014_1
.T
with
113 procedure P
(X
: access T
);
118 with C392014_1
.Child
;
120 package body C392014_0
is
122 function Create
(X
: Integer) return T
'Class is
126 return C392014_1
.Create
(X
/ Ident_Int
(3));
128 return C392014_1
.Child
.Create
(X
/ Ident_Int
(3));
130 return C392014_2
.Create
(X
/ Ident_Int
(3));
141 package body C392014_1
.Child
is
143 procedure P
(X
: access T
) is
145 C392014_0
.Result
:= C392014_0
.Result
+ X
.D
+ X
.C1
+ X
.C1C
;
148 function Create
(X
: Integer) return T
'Class is
149 Y
: T
(D
=> X
mod Ident_Int
(20));
151 Y
.C1
:= (X
/ Ident_Int
(20)) mod Ident_Int
(20);
152 Y
.C1C
:= X
/ Ident_Int
(400);
160 package body C392014_2
is
162 procedure P
(X
: access T
) is
164 C392014_0
.Result
:= C392014_0
.Result
+ X
.D
+ X
.C2
;
167 function Create
(X
: Integer) return T
'Class is
168 Y
: T
(D
=> X
mod Ident_Int
(20));
170 Y
.C2
:= X
/ Ident_Int
(600);
179 with C392014_1
.Child
;
183 subtype S0
is C392014_0
.T
'Class;
184 subtype S1
is C392014_1
.T
'Class;
186 X0
: aliased C392014_0
.T
'Class := C392014_0
.Create
(Ident_Int
(5218));
187 X1
: aliased C392014_1
.T
'Class := C392014_1
.Create
(Ident_Int
(8253));
189 Y0
: aliased S0
:= C392014_0
.Create
(Ident_Int
(2693));
190 Y1
: aliased S1
:= C392014_1
.Create
(Ident_Int
(5622));
192 procedure TC_Check
(Subtest
: String; Expected
: Integer) is
194 if C392014_0
.Result
= Expected
then
195 Comment
("Subtest " & Subtest
& " Passed");
197 Failed
("Subtest " & Subtest
& " Failed");
199 C392014_0
.Result
:= Ident_Int
(0);
204 "Check that objects designated by X'Access " &
205 "(where X is of a class-wide type) and New T'Class'(...) " &
206 "are dynamically tagged and can be used in dispatching " &
209 C392014_0
.P
(X0
'Access);
210 TC_Check
("X0'Access", Ident_Int
(29));
211 C392014_0
.P
(new C392014_0
.T
'Class'(C392014_0.Create (Ident_Int (12850))));
212 TC_Check ("New C392014_0.T'Class", Ident_Int (27));
213 C392014_1.P (X1'Access);
214 TC_Check ("X1'Access", Ident_Int (212));
215 C392014_1.P (new C392014_1.T'Class'(C392014_1
.Create
(Ident_Int
(2031))));
216 TC_Check
("New C392014_1.T'Class", Ident_Int
(65));
217 C392014_0
.P
(Y0
'Access);
218 TC_Check
("Y0'Access", Ident_Int
(18));
219 C392014_0
.P
(new S0
'(C392014_0.Create (Ident_Int (6893))));
220 TC_Check ("New S0", Ident_Int (20));
221 C392014_1.P (Y1'Access);
222 TC_Check ("Y1'Access", Ident_Int (18));
223 C392014_1.P (new S1'(C392014_1
.Create
(Ident_Int
(1861))));
224 TC_Check
("New S1", Ident_Int
(56));