1-- C48009I.ADA
2
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.
15--
16--                                    DISCLAIMER
17--
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 THE DESIGNATED TYPE FOR "NEW T'(X)" IS A CONSTRAINED
27-- ACCESS TYPE, CA, T IS CA'BASE, AND A DISCRIMINANT OR INDEX VALUE OF X
28-- DOES NOT EQUAL A VALUE SPECIFIED FOR CA.
29
30-- EG  08/30/84
31
32WITH REPORT;
33
34PROCEDURE C48009I IS
35
36     USE REPORT;
37
38BEGIN
39
40     TEST("C48009I","FOR ALLOCATORS OF THE FORM 'NEW T'(X)', CHECK " &
41                    "THAT CONSTRAINT_ERROR IS RAISED WHEN " &
42                    "APPROPRIATE - ACCESS TYPE OF CONSTRAINED " &
43                    "ACCESS TYPE");
44
45     DECLARE
46
47          TYPE UR(A : INTEGER) IS
48               RECORD
49                    NULL;
50               END RECORD;
51          TYPE UA IS ARRAY(INTEGER RANGE <>) OF INTEGER;
52
53          PACKAGE P IS
54               TYPE UP(A : INTEGER) IS PRIVATE;
55               TYPE UL(A : INTEGER) IS LIMITED PRIVATE;
56          PRIVATE
57               TYPE UP(A : INTEGER) IS
58                    RECORD
59                         NULL;
60                    END RECORD;
61               TYPE UL(A : INTEGER) IS
62                    RECORD
63                         NULL;
64                    END RECORD;
65          END P;
66
67          TYPE A_UR IS ACCESS UR;
68          TYPE A_UA IS ACCESS UA;
69          TYPE A_UP IS ACCESS P.UP;
70          TYPE A_UL IS ACCESS P.UL;
71
72          TYPE AC_A_UR IS ACCESS A_UR(2);
73          TYPE AC_A_UA IS ACCESS A_UA(2 .. 4);
74          TYPE AC_A_UP IS ACCESS A_UP(3);
75          TYPE AC_A_UL IS ACCESS A_UL(4);
76
77          V_AC_A_UR : AC_A_UR;
78          V_AC_A_UA : AC_A_UA;
79          V_AC_A_UP : AC_A_UP;
80          V_AC_A_UL : AC_A_UL;
81
82     BEGIN
83
84          BEGIN
85               V_AC_A_UR := NEW A_UR'(NEW UR(3));
86               FAILED ("NO EXCEPTION RAISED - UR");
87          EXCEPTION
88               WHEN CONSTRAINT_ERROR =>
89                    NULL;
90               WHEN OTHERS =>
91                    FAILED ("WRONG EXCEPTION RAISED - UR");
92          END;
93
94          BEGIN
95               V_AC_A_UA := NEW A_UA'(NEW UA(3 .. 5));
96               FAILED ("NO EXCEPTION RAISED - UA");
97          EXCEPTION
98               WHEN CONSTRAINT_ERROR =>
99                    NULL;
100               WHEN OTHERS =>
101                    FAILED ("WRONG EXCEPTION RAISED - UA");
102          END;
103
104          BEGIN
105               V_AC_A_UP := NEW A_UP'(NEW P.UP(IDENT_INT(4)));
106               FAILED ("NO EXCEPTION RAISED - UP");
107          EXCEPTION
108               WHEN CONSTRAINT_ERROR =>
109                    NULL;
110               WHEN OTHERS =>
111                    FAILED ("WRONG EXCEPTION RAISED - UP");
112          END;
113
114          BEGIN
115               V_AC_A_UL := NEW A_UL'(NEW P.UL(IDENT_INT(5)));
116               FAILED ("NO EXCEPTION RAISED - UL");
117          EXCEPTION
118               WHEN CONSTRAINT_ERROR =>
119                    NULL;
120               WHEN OTHERS =>
121                    FAILED ("WRONG EXCEPTION RAISED - UL");
122          END;
123
124     END;
125
126     RESULT;
127
128END C48009I;
129