1-- C43105A.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-- OBJECTIVE:
26--     IN A RECORD AGGREGATE, (X => E, Y => E), WHERE E IS AN OVERLOADED
27--     ENUMERATION LITERAL, OVERLOADING RESOLUTION OCCURS SEPARATELY FOR
28--     THE DIFFERENT OCCURRENCES OF E.
29
30-- HISTORY:
31--     DHH 08/10/88 CREATED ORIGINAL TEST.
32
33WITH REPORT; USE REPORT;
34PROCEDURE C43105A IS
35
36BEGIN
37     TEST("C43105A", "IN A RECORD AGGREGATE, (X => E, Y => E), WHERE " &
38                     "E IS AN OVERLOADED ENUMERATION LITERAL, " &
39                     "OVERLOADING RESOLUTION OCCURS SEPARATELY FOR " &
40                     "THE DIFFERENT OCCURRENCES OF E");
41
42     DECLARE
43          TYPE COLOR IS (RED, YELLOW, GREEN);
44          TYPE PALETTE IS (GREEN, YELLOW, RED);
45
46          TYPE REC IS
47               RECORD
48                    X : COLOR;
49                    Y : PALETTE;
50               END RECORD;
51
52          TYPE RECD IS
53               RECORD
54                    X : PALETTE;
55                    Y : COLOR;
56               END RECORD;
57
58          REC1 : REC;
59          REC2 : RECD;
60
61          FUNCTION IDENT_C(C : COLOR) RETURN COLOR IS
62          BEGIN
63               IF EQUAL(3,3) THEN
64                    RETURN C;
65               ELSE
66                    RETURN GREEN;
67               END IF;
68          END IDENT_C;
69
70          FUNCTION IDENT_P(P : PALETTE) RETURN PALETTE IS
71          BEGIN
72               IF EQUAL(3,3) THEN
73                    RETURN P;
74               ELSE
75                    RETURN RED;
76               END IF;
77          END IDENT_P;
78
79
80     BEGIN
81          REC1 := (X => YELLOW, Y => YELLOW);
82          REC2 := (X => YELLOW, Y => YELLOW);
83
84          IF REC1.X /= IDENT_C(REC2.Y) THEN
85               FAILED("COLOR RESOLUTION FAILED");
86          END IF;
87
88          IF REC1.Y /= IDENT_P(REC2.X) THEN
89               FAILED("PALETTE RESOLUTION FAILED");
90          END IF;
91     EXCEPTION
92          WHEN OTHERS =>
93               FAILED("EXCEPTION RAISED");
94     END;
95
96     RESULT;
97END C43105A;
98