OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c8/] [c87b44a.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C87B44A.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
-- THE TYPE OF THE EXPRESSION IN A RETURN STATEMENT MUST MATCH THE
28
-- EXPLICIT TYPEMARK IN THE RETURN CLAUSE OF THE FUNCTION'S
29
-- SPECIFICATION.
30
--
31
-- THE FOUR KINDS OF EXPRESSIONS TESTED HERE ARE:
32
-- 
33
--    (A): A CALL TO AN OVERLOADED FUNCTION.
34
--    (B): AN OVERLOADED OPERATOR SYMBOL.
35
--    (C): AN OVERLOADED (INFIX) OPERATOR.
36
--    (D): AN OVERLOADED ENUMERATION LITERAL.
37
 
38
-- TRH  25 JUNE 82
39
 
40
WITH REPORT; USE REPORT;
41
 
42
PROCEDURE C87B44A IS
43
 
44
     TYPE WHOLE  IS NEW INTEGER RANGE 0..INTEGER'LAST;
45
     TYPE CITRUS IS (LEMON, LIME, ORANGE);
46
     TYPE HUE    IS (RED, ORANGE, YELLOW);
47
 
48
     FUNCTION F1 (X, Y : INTEGER) RETURN INTEGER IS
49
     BEGIN
50
          RETURN -1;
51
     END F1;
52
 
53
     FUNCTION "*" (X, Y : WHOLE) RETURN WHOLE IS
54
     BEGIN
55
          RETURN 0;
56
     END "*";
57
 
58
     FUNCTION "*" (X, Y : INTEGER) RETURN HUE IS
59
     BEGIN
60
          RETURN ORANGE;
61
     END "*";
62
 
63
     FUNCTION F1 (X, Y : INTEGER) RETURN CITRUS IS
64
     BEGIN
65
          RETURN ORANGE;
66
     END F1;
67
 
68
BEGIN
69
     TEST ("C87B44A","OVERLOADED EXPRESSIONS IN RETURN STATEMENTS");
70
     DECLARE
71
 
72
          FUNCTION F2 (X, Y : INTEGER) RETURN INTEGER IS
73
          BEGIN
74
               RETURN F1 (X, Y);
75
          END F2;
76
 
77
          FUNCTION F2 (X, Y : WHOLE) RETURN WHOLE IS
78
          BEGIN
79
               RETURN "*" (X, Y);
80
          END F2;
81
 
82
          FUNCTION F2 (X, Y : INTEGER) RETURN HUE IS
83
          BEGIN
84
               RETURN (X * Y);
85
          END F2;
86
 
87
          FUNCTION F2 (X, Y : INTEGER) RETURN CITRUS IS
88
          BEGIN
89
               RETURN ORANGE;
90
          END F2;
91
 
92
 
93
     BEGIN
94
          IF INTEGER'(F2 (0, 0)) /= -1 THEN
95
             FAILED ("(A): RESOLUTION INCORRECT - FUNCTION CALL");
96
          END IF;
97
 
98
          IF WHOLE'(F2 (0, 0)) /= 0 THEN
99
             FAILED ("(B): RESOLUTION INCORRECT - OPERATOR SYMBOL");
100
          END IF;
101
 
102
          IF HUE'POS (F2 (0, 0)) /= 1 THEN
103
             FAILED ("(C): RESOLUTION INCORRECT - INFIX OPERATOR");
104
          END IF;
105
 
106
          IF CITRUS'POS (F2 (0, 0)) /= 2 THEN
107
             FAILED ("(D): RESOLUTION INCORRECT - ENUMERATION LITERAL");
108
          END IF;
109
     END;
110
 
111
     RESULT;
112
END C87B44A;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.