annotate gcc/testsuite/ada/acats/tests/c4/c460a01.a @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 -- C460A01.A
kono
parents:
diff changeset
2 --
kono
parents:
diff changeset
3 -- Grant of Unlimited Rights
kono
parents:
diff changeset
4 --
kono
parents:
diff changeset
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
kono
parents:
diff changeset
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
kono
parents:
diff changeset
7 -- unlimited rights in the software and documentation contained herein.
kono
parents:
diff changeset
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
kono
parents:
diff changeset
9 -- this public release, the Government intends to confer upon all
kono
parents:
diff changeset
10 -- recipients unlimited rights equal to those held by the Government.
kono
parents:
diff changeset
11 -- These rights include rights to use, duplicate, release or disclose the
kono
parents:
diff changeset
12 -- released technical data and computer software in whole or in part, in
kono
parents:
diff changeset
13 -- any manner and for any purpose whatsoever, and to have or permit others
kono
parents:
diff changeset
14 -- to do so.
kono
parents:
diff changeset
15 --
kono
parents:
diff changeset
16 -- DISCLAIMER
kono
parents:
diff changeset
17 --
kono
parents:
diff changeset
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
kono
parents:
diff changeset
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
kono
parents:
diff changeset
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
kono
parents:
diff changeset
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
kono
parents:
diff changeset
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
kono
parents:
diff changeset
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
kono
parents:
diff changeset
24 --*
kono
parents:
diff changeset
25 --
kono
parents:
diff changeset
26 -- OBJECTIVE:
kono
parents:
diff changeset
27 -- Check that if the target type of a type conversion is a general
kono
parents:
diff changeset
28 -- access type, Program_Error is raised if the accessibility level of
kono
parents:
diff changeset
29 -- the operand type is deeper than that of the target type. Check for
kono
parents:
diff changeset
30 -- cases where the type conversion occurs in an instance body, and
kono
parents:
diff changeset
31 -- the operand type is passed as an actual during instantiation.
kono
parents:
diff changeset
32 --
kono
parents:
diff changeset
33 -- TEST DESCRIPTION:
kono
parents:
diff changeset
34 -- In order to satisfy accessibility requirements, the operand type must
kono
parents:
diff changeset
35 -- be at the same or a less deep nesting level than the target type -- the
kono
parents:
diff changeset
36 -- operand type must "live" as long as the target type. Nesting levels
kono
parents:
diff changeset
37 -- are the run-time nestings of masters: block statements; subprogram,
kono
parents:
diff changeset
38 -- task, and entry bodies; and accept statements. Packages are invisible
kono
parents:
diff changeset
39 -- to accessibility rules.
kono
parents:
diff changeset
40 --
kono
parents:
diff changeset
41 -- This test checks for cases where the operand is a subprogram formal
kono
parents:
diff changeset
42 -- parameter.
kono
parents:
diff changeset
43 --
kono
parents:
diff changeset
44 -- The test declares three generic packages, each containing an access
kono
parents:
diff changeset
45 -- type conversion in which the operand type is a formal type:
kono
parents:
diff changeset
46 --
kono
parents:
diff changeset
47 -- (1) One in which the target type is declared within the
kono
parents:
diff changeset
48 -- specification, and the conversion occurs within a nested
kono
parents:
diff changeset
49 -- function.
kono
parents:
diff changeset
50 --
kono
parents:
diff changeset
51 -- (2) One in which the target type is also a formal type, and
kono
parents:
diff changeset
52 -- the conversion occurs within a nested function.
kono
parents:
diff changeset
53 --
kono
parents:
diff changeset
54 -- (3) One in which the target type is declared outside the
kono
parents:
diff changeset
55 -- generic, and the conversion occurs within a nested
kono
parents:
diff changeset
56 -- procedure.
kono
parents:
diff changeset
57 --
kono
parents:
diff changeset
58 -- The test verifies the following:
kono
parents:
diff changeset
59 --
kono
parents:
diff changeset
60 -- For (1), Program_Error is not raised when the nested function is
kono
parents:
diff changeset
61 -- called. Since the actual corresponding to the formal operand type
kono
parents:
diff changeset
62 -- must always have the same or a less deep level than the target
kono
parents:
diff changeset
63 -- type declared within the instance, the access type conversion is
kono
parents:
diff changeset
64 -- always safe.
kono
parents:
diff changeset
65 --
kono
parents:
diff changeset
66 -- For (2), Program_Error is raised when the nested function is
kono
parents:
diff changeset
67 -- called if the operand type passed as an actual during instantiation
kono
parents:
diff changeset
68 -- has an accessibility level deeper than that of the target type
kono
parents:
diff changeset
69 -- passed as an actual, and that no exception is raised otherwise.
kono
parents:
diff changeset
70 -- The exception is propagated to the innermost enclosing master.
kono
parents:
diff changeset
71 --
kono
parents:
diff changeset
72 -- For (3), Program_Error is raised when the nested procedure is
kono
parents:
diff changeset
73 -- called if the operand type passed as an actual during instantiation
kono
parents:
diff changeset
74 -- has an accessibility level deeper than that of the target type.
kono
parents:
diff changeset
75 -- The exception is handled within the nested procedure.
kono
parents:
diff changeset
76 --
kono
parents:
diff changeset
77 -- TEST FILES:
kono
parents:
diff changeset
78 -- The following files comprise this test:
kono
parents:
diff changeset
79 --
kono
parents:
diff changeset
80 -- F460A00.A
kono
parents:
diff changeset
81 -- => C460A01.A
kono
parents:
diff changeset
82 --
kono
parents:
diff changeset
83 --
kono
parents:
diff changeset
84 -- CHANGE HISTORY:
kono
parents:
diff changeset
85 -- 09 May 95 SAIC Initial prerelease version.
kono
parents:
diff changeset
86 -- 24 Apr 96 SAIC Added code to avoid dead variable optimization.
kono
parents:
diff changeset
87 -- 13 Feb 97 PWB.CTA Removed 'Class from qual expression at line 342.
kono
parents:
diff changeset
88 --!
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 generic
kono
parents:
diff changeset
91 type Designated_Type is tagged private;
kono
parents:
diff changeset
92 type Operand_Type is access Designated_Type;
kono
parents:
diff changeset
93 package C460A01_0 is
kono
parents:
diff changeset
94 type Target_Type is access all Designated_Type;
kono
parents:
diff changeset
95 function Convert (P : Operand_Type) return Target_Type;
kono
parents:
diff changeset
96 end C460A01_0;
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 --==================================================================--
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 package body C460A01_0 is
kono
parents:
diff changeset
103 function Convert (P : Operand_Type) return Target_Type is
kono
parents:
diff changeset
104 begin
kono
parents:
diff changeset
105 return Target_Type(P); -- Never fails.
kono
parents:
diff changeset
106 end Convert;
kono
parents:
diff changeset
107 end C460A01_0;
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 --==================================================================--
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 generic
kono
parents:
diff changeset
114 type Designated_Type is tagged private;
kono
parents:
diff changeset
115 type Operand_Type is access all Designated_Type;
kono
parents:
diff changeset
116 type Target_Type is access all Designated_Type;
kono
parents:
diff changeset
117 package C460A01_1 is
kono
parents:
diff changeset
118 function Convert (P : Operand_Type) return Target_Type;
kono
parents:
diff changeset
119 end C460A01_1;
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 --==================================================================--
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 package body C460A01_1 is
kono
parents:
diff changeset
126 function Convert (P : Operand_Type) return Target_Type is
kono
parents:
diff changeset
127 begin
kono
parents:
diff changeset
128 return Target_Type(P);
kono
parents:
diff changeset
129 end Convert;
kono
parents:
diff changeset
130 end C460A01_1;
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 --==================================================================--
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135
kono
parents:
diff changeset
136 with F460A00;
kono
parents:
diff changeset
137 generic
kono
parents:
diff changeset
138 type Designated_Type (<>) is new F460A00.Tagged_Type with private;
kono
parents:
diff changeset
139 type Operand_Type is access Designated_Type;
kono
parents:
diff changeset
140 package C460A01_2 is
kono
parents:
diff changeset
141 procedure Proc (P : Operand_Type;
kono
parents:
diff changeset
142 Res : out F460A00.TC_Result_Kind);
kono
parents:
diff changeset
143 end C460A01_2;
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146 --==================================================================--
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 with Report;
kono
parents:
diff changeset
149 package body C460A01_2 is
kono
parents:
diff changeset
150 procedure Proc (P : Operand_Type;
kono
parents:
diff changeset
151 Res : out F460A00.TC_Result_Kind) is
kono
parents:
diff changeset
152 Ptr : F460A00.AccTag_L0;
kono
parents:
diff changeset
153 begin
kono
parents:
diff changeset
154 Ptr := F460A00.AccTag_L0(P);
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 -- Avoid optimization (dead variable removal of Ptr):
kono
parents:
diff changeset
157 if not Report.Equal (Ptr.C, Ptr.C) then -- Always false.
kono
parents:
diff changeset
158 Report.Failed ("Unexpected error in C460A01_2 instance");
kono
parents:
diff changeset
159 end if;
kono
parents:
diff changeset
160
kono
parents:
diff changeset
161 Res := F460A00.OK;
kono
parents:
diff changeset
162 exception
kono
parents:
diff changeset
163 when Program_Error => Res := F460A00.PE_Exception;
kono
parents:
diff changeset
164 when others => Res := F460A00.Others_Exception;
kono
parents:
diff changeset
165 end Proc;
kono
parents:
diff changeset
166 end C460A01_2;
kono
parents:
diff changeset
167
kono
parents:
diff changeset
168
kono
parents:
diff changeset
169 --==================================================================--
kono
parents:
diff changeset
170
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 with F460A00;
kono
parents:
diff changeset
173 with C460A01_0;
kono
parents:
diff changeset
174 with C460A01_1;
kono
parents:
diff changeset
175 with C460A01_2;
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 with Report;
kono
parents:
diff changeset
178 procedure C460A01 is
kono
parents:
diff changeset
179 begin -- C460A01. -- [ Level = 1 ]
kono
parents:
diff changeset
180
kono
parents:
diff changeset
181 Report.Test ("C460A01", "Run-time accessibility checks: instance " &
kono
parents:
diff changeset
182 "bodies. Operand type of access type conversion is " &
kono
parents:
diff changeset
183 "passed as actual to instance");
kono
parents:
diff changeset
184
kono
parents:
diff changeset
185
kono
parents:
diff changeset
186 SUBTEST1:
kono
parents:
diff changeset
187 declare -- [ Level = 2 ]
kono
parents:
diff changeset
188 type AccTag_L2 is access all F460A00.Tagged_Type;
kono
parents:
diff changeset
189 Operand: AccTag_L2 := new F460A00.Tagged_Type;
kono
parents:
diff changeset
190
kono
parents:
diff changeset
191 Result : F460A00.TC_Result_Kind := F460A00.UN_Init;
kono
parents:
diff changeset
192 begin -- SUBTEST1.
kono
parents:
diff changeset
193
kono
parents:
diff changeset
194 declare -- [ Level = 3 ]
kono
parents:
diff changeset
195 -- The instantiation of C460A01_0 should NOT result in any
kono
parents:
diff changeset
196 -- exceptions.
kono
parents:
diff changeset
197
kono
parents:
diff changeset
198 package Pack_OK is new C460A01_0 (F460A00.Tagged_Type, AccTag_L2);
kono
parents:
diff changeset
199 Target : Pack_OK.Target_Type;
kono
parents:
diff changeset
200 begin
kono
parents:
diff changeset
201 -- The accessibility level of Pack_OK.Target_Type will always be at
kono
parents:
diff changeset
202 -- least as deep as the operand type passed as an actual. Thus,
kono
parents:
diff changeset
203 -- a call to Pack_OK.Convert does not propagate an exception:
kono
parents:
diff changeset
204
kono
parents:
diff changeset
205 Target := Pack_OK.Convert(Operand);
kono
parents:
diff changeset
206
kono
parents:
diff changeset
207 -- Avoid optimization (dead variable removal of Target):
kono
parents:
diff changeset
208 if not Report.Equal (Target.C, Target.C) then -- Always false.
kono
parents:
diff changeset
209 Report.Failed ("Unexpected error in SUBTEST #1");
kono
parents:
diff changeset
210 end if;
kono
parents:
diff changeset
211
kono
parents:
diff changeset
212 Result := F460A00.OK; -- Expected result.
kono
parents:
diff changeset
213 exception
kono
parents:
diff changeset
214 when Program_Error => Result := F460A00.PE_Exception;
kono
parents:
diff changeset
215 when others => Result := F460A00.Others_Exception;
kono
parents:
diff changeset
216 end;
kono
parents:
diff changeset
217
kono
parents:
diff changeset
218 F460A00.TC_Check_Results (Result, F460A00.OK, "SUBTEST #1");
kono
parents:
diff changeset
219
kono
parents:
diff changeset
220 exception
kono
parents:
diff changeset
221 when Program_Error =>
kono
parents:
diff changeset
222 Report.Failed ("SUBTEST #1: Program_Error incorrectly raised");
kono
parents:
diff changeset
223 when others =>
kono
parents:
diff changeset
224 Report.Failed ("SUBTEST #1: Unexpected exception raised");
kono
parents:
diff changeset
225 end SUBTEST1;
kono
parents:
diff changeset
226
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228
kono
parents:
diff changeset
229 SUBTEST2:
kono
parents:
diff changeset
230 declare -- [ Level = 2 ]
kono
parents:
diff changeset
231 type AccTag_L2 is access all F460A00.Tagged_Type;
kono
parents:
diff changeset
232 Operand : AccTag_L2 := new F460A00.Tagged_Type;
kono
parents:
diff changeset
233
kono
parents:
diff changeset
234 Result : F460A00.TC_Result_Kind := F460A00.UN_Init;
kono
parents:
diff changeset
235 begin -- SUBTEST2.
kono
parents:
diff changeset
236
kono
parents:
diff changeset
237 declare -- [ Level = 3 ]
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239 type AccTag_L3 is access all F460A00.Tagged_Type;
kono
parents:
diff changeset
240 Target : AccTag_L3;
kono
parents:
diff changeset
241
kono
parents:
diff changeset
242 -- The instantiation of C460A01_1 should NOT result in any
kono
parents:
diff changeset
243 -- exceptions.
kono
parents:
diff changeset
244
kono
parents:
diff changeset
245 package Pack_OK is new C460A01_1
kono
parents:
diff changeset
246 (Designated_Type => F460A00.Tagged_Type,
kono
parents:
diff changeset
247 Operand_Type => AccTag_L2,
kono
parents:
diff changeset
248 Target_Type => AccTag_L3);
kono
parents:
diff changeset
249 begin
kono
parents:
diff changeset
250 -- The accessibility level of the actual passed as the operand type
kono
parents:
diff changeset
251 -- in Pack_OK is 2. The accessibility level of the actual passed as
kono
parents:
diff changeset
252 -- the target type is 3. Therefore, the access type conversion in
kono
parents:
diff changeset
253 -- Pack_OK.Convert does not raise an exception when the subprogram is
kono
parents:
diff changeset
254 -- called. If an exception is (incorrectly) raised, it is propagated
kono
parents:
diff changeset
255 -- to the innermost enclosing master:
kono
parents:
diff changeset
256
kono
parents:
diff changeset
257 Target := Pack_OK.Convert(Operand);
kono
parents:
diff changeset
258
kono
parents:
diff changeset
259 -- Avoid optimization (dead variable removal of Target):
kono
parents:
diff changeset
260 if not Report.Equal (Target.C, Target.C) then -- Always false.
kono
parents:
diff changeset
261 Report.Failed ("Unexpected error in SUBTEST #2");
kono
parents:
diff changeset
262 end if;
kono
parents:
diff changeset
263
kono
parents:
diff changeset
264 Result := F460A00.OK; -- Expected result.
kono
parents:
diff changeset
265 exception
kono
parents:
diff changeset
266 when Program_Error => Result := F460A00.PE_Exception;
kono
parents:
diff changeset
267 when others => Result := F460A00.Others_Exception;
kono
parents:
diff changeset
268 end;
kono
parents:
diff changeset
269
kono
parents:
diff changeset
270 F460A00.TC_Check_Results (Result, F460A00.OK, "SUBTEST #2");
kono
parents:
diff changeset
271
kono
parents:
diff changeset
272 exception
kono
parents:
diff changeset
273 when Program_Error =>
kono
parents:
diff changeset
274 Report.Failed ("SUBTEST #2: Program_Error incorrectly raised");
kono
parents:
diff changeset
275 when others =>
kono
parents:
diff changeset
276 Report.Failed ("SUBTEST #2: Unexpected exception raised");
kono
parents:
diff changeset
277 end SUBTEST2;
kono
parents:
diff changeset
278
kono
parents:
diff changeset
279
kono
parents:
diff changeset
280
kono
parents:
diff changeset
281 SUBTEST3:
kono
parents:
diff changeset
282 declare -- [ Level = 2 ]
kono
parents:
diff changeset
283 type AccTag_L2 is access all F460A00.Tagged_Type;
kono
parents:
diff changeset
284 Target : AccTag_L2;
kono
parents:
diff changeset
285
kono
parents:
diff changeset
286 Result : F460A00.TC_Result_Kind := F460A00.UN_Init;
kono
parents:
diff changeset
287 begin -- SUBTEST3.
kono
parents:
diff changeset
288
kono
parents:
diff changeset
289 declare -- [ Level = 3 ]
kono
parents:
diff changeset
290
kono
parents:
diff changeset
291 type AccTag_L3 is access all F460A00.Tagged_Type;
kono
parents:
diff changeset
292 Operand : AccTag_L3 := new F460A00.Tagged_Type;
kono
parents:
diff changeset
293
kono
parents:
diff changeset
294 -- The instantiation of C460A01_1 should NOT result in any
kono
parents:
diff changeset
295 -- exceptions.
kono
parents:
diff changeset
296
kono
parents:
diff changeset
297 package Pack_PE is new C460A01_1
kono
parents:
diff changeset
298 (Designated_Type => F460A00.Tagged_Type,
kono
parents:
diff changeset
299 Operand_Type => AccTag_L3,
kono
parents:
diff changeset
300 Target_Type => AccTag_L2);
kono
parents:
diff changeset
301 begin
kono
parents:
diff changeset
302 -- The accessibility level of the actual passed as the operand type
kono
parents:
diff changeset
303 -- in Pack_PE is 3. The accessibility level of the actual passed as
kono
parents:
diff changeset
304 -- the target type is 2. Therefore, the access type conversion in
kono
parents:
diff changeset
305 -- Pack_PE.Convert raises Program_Error when the subprogram is
kono
parents:
diff changeset
306 -- called. The exception is propagated to the innermost enclosing
kono
parents:
diff changeset
307 -- master:
kono
parents:
diff changeset
308
kono
parents:
diff changeset
309 Target := Pack_PE.Convert(Operand);
kono
parents:
diff changeset
310
kono
parents:
diff changeset
311 -- Avoid optimization (dead variable removal of Target):
kono
parents:
diff changeset
312 if not Report.Equal (Target.C, Target.C) then -- Always false.
kono
parents:
diff changeset
313 Report.Failed ("Unexpected error in SUBTEST #3");
kono
parents:
diff changeset
314 end if;
kono
parents:
diff changeset
315
kono
parents:
diff changeset
316 Result := F460A00.OK;
kono
parents:
diff changeset
317 exception
kono
parents:
diff changeset
318 when Program_Error => Result := F460A00.PE_Exception;
kono
parents:
diff changeset
319 -- Expected result.
kono
parents:
diff changeset
320 when others => Result := F460A00.Others_Exception;
kono
parents:
diff changeset
321 end;
kono
parents:
diff changeset
322
kono
parents:
diff changeset
323 F460A00.TC_Check_Results (Result, F460A00.PE_Exception, "SUBTEST #3");
kono
parents:
diff changeset
324
kono
parents:
diff changeset
325 exception
kono
parents:
diff changeset
326 when Program_Error =>
kono
parents:
diff changeset
327 Report.Failed ("SUBTEST #3: Program_Error incorrectly raised");
kono
parents:
diff changeset
328 when others =>
kono
parents:
diff changeset
329 Report.Failed ("SUBTEST #3: Unexpected exception raised");
kono
parents:
diff changeset
330 end SUBTEST3;
kono
parents:
diff changeset
331
kono
parents:
diff changeset
332
kono
parents:
diff changeset
333
kono
parents:
diff changeset
334 SUBTEST4:
kono
parents:
diff changeset
335 declare -- [ Level = 2 ]
kono
parents:
diff changeset
336 Result : F460A00.TC_Result_Kind := F460A00.UN_Init;
kono
parents:
diff changeset
337 begin -- SUBTEST4.
kono
parents:
diff changeset
338
kono
parents:
diff changeset
339 declare -- [ Level = 3 ]
kono
parents:
diff changeset
340
kono
parents:
diff changeset
341 TType : F460A00.Tagged_Type;
kono
parents:
diff changeset
342 Operand : F460A00.AccTagClass_L0
kono
parents:
diff changeset
343 := new F460A00.Tagged_Type'(TType);
kono
parents:
diff changeset
344
kono
parents:
diff changeset
345 -- The instantiation of C460A01_2 should NOT result in any
kono
parents:
diff changeset
346 -- exceptions.
kono
parents:
diff changeset
347
kono
parents:
diff changeset
348 package Pack_OK is new C460A01_2 (F460A00.Tagged_Type'Class,
kono
parents:
diff changeset
349 F460A00.AccTagClass_L0);
kono
parents:
diff changeset
350 begin
kono
parents:
diff changeset
351 -- The accessibility level of the actual passed as the operand type
kono
parents:
diff changeset
352 -- in Pack_OK is 0. The accessibility level of the target type
kono
parents:
diff changeset
353 -- (F460A00.AccTag_L0) is also 0. Therefore, the access type
kono
parents:
diff changeset
354 -- conversion in Pack_OK.Proc does not raise an exception when the
kono
parents:
diff changeset
355 -- subprogram is called. If an exception is (incorrectly) raised,
kono
parents:
diff changeset
356 -- it is handled within the subprogram:
kono
parents:
diff changeset
357
kono
parents:
diff changeset
358 Pack_OK.Proc(Operand, Result);
kono
parents:
diff changeset
359 end;
kono
parents:
diff changeset
360
kono
parents:
diff changeset
361 F460A00.TC_Check_Results (Result, F460A00.OK, "SUBTEST #4");
kono
parents:
diff changeset
362
kono
parents:
diff changeset
363 exception
kono
parents:
diff changeset
364 when Program_Error =>
kono
parents:
diff changeset
365 Report.Failed ("SUBTEST #4: Program_Error incorrectly raised");
kono
parents:
diff changeset
366 when others =>
kono
parents:
diff changeset
367 Report.Failed ("SUBTEST #4: Unexpected exception raised");
kono
parents:
diff changeset
368 end SUBTEST4;
kono
parents:
diff changeset
369
kono
parents:
diff changeset
370
kono
parents:
diff changeset
371
kono
parents:
diff changeset
372 SUBTEST5:
kono
parents:
diff changeset
373 declare -- [ Level = 2 ]
kono
parents:
diff changeset
374 Result : F460A00.TC_Result_Kind := F460A00.UN_Init;
kono
parents:
diff changeset
375 begin -- SUBTEST5.
kono
parents:
diff changeset
376
kono
parents:
diff changeset
377 declare -- [ Level = 3 ]
kono
parents:
diff changeset
378
kono
parents:
diff changeset
379 type AccDerTag_L3 is access all F460A00.Derived_Tagged_Type;
kono
parents:
diff changeset
380 Operand : AccDerTag_L3 := new F460A00.Derived_Tagged_Type;
kono
parents:
diff changeset
381
kono
parents:
diff changeset
382 -- The instantiation of C460A01_2 should NOT result in any
kono
parents:
diff changeset
383 -- exceptions.
kono
parents:
diff changeset
384
kono
parents:
diff changeset
385 package Pack_PE is new C460A01_2 (F460A00.Derived_Tagged_Type,
kono
parents:
diff changeset
386 AccDerTag_L3);
kono
parents:
diff changeset
387 begin
kono
parents:
diff changeset
388 -- The accessibility level of the actual passed as the operand type
kono
parents:
diff changeset
389 -- in Pack_PE is 3. The accessibility level of the target type
kono
parents:
diff changeset
390 -- (F460A00.AccTag_L0) is 0. Therefore, the access type conversion
kono
parents:
diff changeset
391 -- in Pack_PE.Proc raises Program_Error when the subprogram is
kono
parents:
diff changeset
392 -- called. The exception is handled within the subprogram:
kono
parents:
diff changeset
393
kono
parents:
diff changeset
394 Pack_PE.Proc(Operand, Result);
kono
parents:
diff changeset
395 end;
kono
parents:
diff changeset
396
kono
parents:
diff changeset
397 F460A00.TC_Check_Results (Result, F460A00.PE_Exception, "SUBTEST #5");
kono
parents:
diff changeset
398
kono
parents:
diff changeset
399 exception
kono
parents:
diff changeset
400 when Program_Error =>
kono
parents:
diff changeset
401 Report.Failed ("SUBTEST #5: Program_Error incorrectly raised");
kono
parents:
diff changeset
402 when others =>
kono
parents:
diff changeset
403 Report.Failed ("SUBTEST #5: Unexpected exception raised");
kono
parents:
diff changeset
404 end SUBTEST5;
kono
parents:
diff changeset
405
kono
parents:
diff changeset
406 Report.Result;
kono
parents:
diff changeset
407
kono
parents:
diff changeset
408 end C460A01;