Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / ada / acats / tests / c4 / c48009c.ada
blob80d18f3426f71fac226b33adf8c9a3d5ecd07c9d
1 -- C48009C.ADA
3 -- Grant of Unlimited Rights
4 --
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7 -- unlimited rights in the software and documentation contained herein.
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
9 -- this public release, the Government intends to confer upon all
10 -- recipients unlimited rights equal to those held by the Government.
11 -- These rights include rights to use, duplicate, release or disclose the
12 -- released technical data and computer software in whole or in part, in
13 -- any manner and for any purpose whatsoever, and to have or permit others
14 -- to do so.
16 -- DISCLAIMER
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.
24 --*
25 -- FOR ALLOCATORS OF THE FORM "NEW T'(X)", CHECK THAT CONSTRAINT_ERROR
26 -- IS RAISED IF T IS A CONSTRAINED RECORD OR PRIVATE TYPE, (X) IS AN
27 -- AGGREGATE OR A VALUE OF TYPE T, AND ONE OF THE DISCRIMINANT VALUES IN
28 -- X:
29 -- 1) DOES NOT EQUAL THE CORRESPONDING DISCRIMINANT VALUE FOR T.
30 -- 2) DOES NOT EQUAL THE CORRESPONDING DISCRIMINANT VALUE SPECIFIED
31 -- IN THE DECLARATION OF THE ALLOCATOR'S BASE TYPE.
32 -- 3) DOES NOT EQUAL THE CORRESPONDING DISCRIMINANT VALUE IN THE
33 -- ACCESS TO ACCESS CASE.
35 -- RM 01/08/80
36 -- NL 10/13/81
37 -- SPS 10/26/82
38 -- EG 07/05/84
40 WITH REPORT;
42 PROCEDURE C48009C IS
44 USE REPORT;
46 BEGIN
48 TEST("C48009C","FOR ALLOCATORS OF THE FORM 'NEW T'(X)', CHECK " &
49 "THAT CONSTRAINT_ERROR IS RAISED WHEN " &
50 "APPROPRIATE - CONSTRAINED RECORD TYPES");
52 DECLARE
54 TYPE TC0(A, B : INTEGER) IS
55 RECORD
56 C : INTEGER RANGE 1 .. 7;
57 END RECORD;
58 SUBTYPE TC IS TC0(2, 3);
59 TYPE ATC IS ACCESS TC0(2, 3);
60 SUBTYPE TC4_5 IS TC0(IDENT_INT(4), IDENT_INT(5));
61 VC : ATC;
63 BEGIN
65 BEGIN
66 VC := NEW TC'(102, 3, 4);
67 FAILED ("NO EXCEPTION RAISED - CASE 1");
68 EXCEPTION
69 WHEN CONSTRAINT_ERROR => NULL;
70 WHEN OTHERS =>
71 FAILED("WRONG EXCEPTION RAISED - CASE 1");
72 END;
74 BEGIN
75 VC := NEW TC4_5'(IDENT_INT(4), IDENT_INT(5), 1);
76 FAILED ("NO EXCEPTION RAISED - CASE 2");
77 EXCEPTION
78 WHEN CONSTRAINT_ERROR => NULL;
79 WHEN OTHERS =>
80 FAILED("WRONG EXCEPTION RAISED - CASE 2");
81 END;
83 END;
85 DECLARE
87 TYPE UR(A : INTEGER) IS
88 RECORD
89 NULL;
90 END RECORD;
91 TYPE A_UR IS ACCESS UR;
92 SUBTYPE CA_UR IS A_UR(2);
93 TYPE A_CA_UR IS ACCESS CA_UR;
95 V : A_CA_UR;
97 BEGIN
99 V := NEW CA_UR'(NEW UR'(A => IDENT_INT(3)));
100 FAILED ("NO EXCEPTION RAISED - CASE 3");
102 EXCEPTION
104 WHEN CONSTRAINT_ERROR =>
105 NULL;
106 WHEN OTHERS =>
107 FAILED ("WRONG EXCEPTION RAISED - CASE 3");
109 END;
111 RESULT;
113 END C48009C;