1-- C48007A.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", CHECK THAT CONSTRAINT_ERROR IS
26-- RAISED IF T IS AN UNCONSTRAINED TYPE WITH DEFAULT DISCRIMINANTS
27-- (RECORD, PRIVATE OR LIMITED) AND ONE DEFAULT DISCRIMINANT VALUE DOES
28-- NOT EQUAL THE CORRESPONDING VALUE SPECIFIED FOR THE ALLOCATOR'S BASE
29-- TYPE.
30
31-- EG  08/10/84
32
33WITH REPORT;
34
35PROCEDURE C48007A IS
36
37     USE REPORT;
38
39BEGIN
40
41     TEST("C48007A","FOR ALLOCATORS OF THE FORM 'NEW T' CHECK " &
42                    "THAT CONSTRAINT_ERROR IS RAISED WHEN "     &
43                    "APPROPRIATE - UNCONSTRAINED TYPE WITH "    &
44                    "DEFAULT DISCRIMINANTS");
45
46     DECLARE
47
48          TYPE UR(A : INTEGER := 1; B : INTEGER := 2) IS
49               RECORD
50                    C : INTEGER := 7;
51               END RECORD;
52
53          PACKAGE P IS
54
55               TYPE UP(A : INTEGER := 12; B : INTEGER := 13) IS
56                    PRIVATE;
57               TYPE UL(A, B : INTEGER := 4) IS LIMITED PRIVATE;
58
59          PRIVATE
60
61               TYPE UP(A : INTEGER := 12; B : INTEGER := 13) IS
62                    RECORD
63                         C : INTEGER := 8;
64                    END RECORD;
65               TYPE UL(A, B : INTEGER := 4) IS
66                    RECORD
67                         C : INTEGER := 9;
68                    END RECORD;
69
70          END P;
71
72          USE P;
73
74          TYPE A_UR IS ACCESS UR(1, 9);
75          TYPE A_UP IS ACCESS UP(9, 13);
76          TYPE A_UL IS ACCESS UL(4, 9);
77
78          VUR : A_UR;
79          VUP : A_UP;
80          VUL : A_UL;
81
82     BEGIN
83
84          BEGIN -- UR
85
86               VUR := NEW UR;
87               FAILED("NO EXCEPTION RAISED - UR");
88
89          EXCEPTION
90
91               WHEN CONSTRAINT_ERROR =>
92                    NULL;
93               WHEN OTHERS =>
94                    FAILED("WRONG EXCEPTION RAISED - UR");
95
96          END;
97
98          BEGIN -- UP
99
100               VUP := NEW UP;
101               FAILED("NO EXCEPTION RAISED - UP");
102
103          EXCEPTION
104
105               WHEN CONSTRAINT_ERROR =>
106                    NULL;
107               WHEN OTHERS =>
108                    FAILED("WRONG EXCEPTION RAISED - UP");
109
110          END;
111
112          BEGIN -- UL
113
114               VUL := NEW UL;
115               FAILED("NO EXCEPTION RAISED - UL");
116
117          EXCEPTION
118
119               WHEN CONSTRAINT_ERROR =>
120                    NULL;
121               WHEN OTHERS =>
122                    FAILED("WRONG EXCEPTION RAISED - UL");
123
124          END;
125
126     END;
127
128     RESULT;
129
130END C48007A;
131