1-- C87B07C.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-- CHECK THAT OVERLOADING RESOLUTION USES THE RULE THAT:
26--
27-- FOR THE ATTRIBUTE OF THE FORM T'VALUE (X), THE OPERAND X MUST
28-- BE OF THE PREDEFINED TYPE STRING. THE RESULT IS OF TYPE T.
29
30-- TRH  13 SEPT 82
31-- PWN 01/31/95  REMOVED INCONSISTENCIES WITH ADA 9X.
32
33WITH REPORT; USE REPORT;
34
35PROCEDURE C87B07C IS
36
37     TYPE CHAR IS NEW CHARACTER;
38     TYPE LITS IS (' ', '+', '1');
39     TYPE WORD IS ARRAY (POSITIVE RANGE 1..4) OF CHARACTER;
40     TYPE LINE IS ARRAY (POSITIVE RANGE 1..4) OF CHAR;
41     TYPE LIST IS ARRAY (POSITIVE RANGE 1..4) OF LITS;
42     TYPE STR  IS ARRAY (POSITIVE RANGE 1..4) OF STRING (1 .. 1);
43     TYPE STR2 IS NEW STRING (1..4);
44     TYPE FLAG IS (PASS, FAIL);
45     SUBTYPE MY_STRING IS STRING (1..4);
46
47     GENERIC
48          TYPE T IS PRIVATE;
49          ARG  : IN T;
50          STAT : IN FLAG;
51     FUNCTION F1 RETURN T;
52
53     FUNCTION F1 RETURN T IS
54     BEGIN
55          IF STAT = FAIL THEN
56               FAILED ("THE 'VALUE' ATTRIBUTE TAKES AN OPERAND" &
57                       " OF THE TYPE PREDEFINED STRING");
58          END IF;
59          RETURN ARG;
60     END F1;
61
62     FUNCTION F IS NEW F1 (STR2,   " +1 ",               FAIL);
63     FUNCTION F IS NEW F1 (LIST,   " +1 ",               FAIL);
64     FUNCTION F IS NEW F1 (WORD,   (' ', '+', '1', ' '), FAIL);
65     FUNCTION F IS NEW F1 (STR,    (" ", "+", "1", " "), FAIL);
66     FUNCTION F IS NEW F1 (LINE,   (' ', '+', '1', ' '), FAIL);
67     FUNCTION F IS NEW F1 (MY_STRING, " +1 ",               PASS);
68
69BEGIN
70     TEST ("C87B07C","OVERLOADED OPERANDS TO THE 'VALUE' ATTRIBUTE");
71
72     DECLARE
73          TYPE INT IS NEW INTEGER;
74          FUNCTION "-" (X : INT) RETURN INT
75               RENAMES "+";
76
77     BEGIN
78          IF INT'VALUE (F) /= -1 THEN
79               FAILED ("THE ATTRIBUTE T'VALUE MUST RETURN A VALUE" &
80                       " OF TYPE T");
81          END IF;
82     END;
83
84     RESULT;
85END C87B07C;
86