aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/ada/acats/tests/c6/c631001.a
blob: f8b0c775b1538414502519efd5e9282f95b93471 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
-- C631001.A
--
--                             Grant of Unlimited Rights
--
--     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
--     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained 
--     unlimited rights in the software and documentation contained herein.
--     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making 
--     this public release, the Government intends to confer upon all 
--     recipients unlimited rights  equal to those held by the Government.  
--     These rights include rights to use, duplicate, release or disclose the 
--     released technical data and computer software in whole or in part, in 
--     any manner and for any purpose whatsoever, and to have or permit others 
--     to do so.
--
--                                    DISCLAIMER
--
--     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
--     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED 
--     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
--     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE 
--     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
--     PARTICULAR PURPOSE OF SAID MATERIAL.
--*
--
-- OBJECTIVE:
--      Check that if different forms of a name are used in the default 
--      expression of a discriminant part, the selector may be an operator
--      symbol or a character literal.
--
-- TEST DESCRIPTION:
--      This transition test defines private types where their selectors in
--      the default expression of the discriminant parts at the full type 
--      declarations are an operator and a literal, respectively. 
--      The test also declares procedures that use an operator and a literal
--      as selectors in the formal parts. 
--
--      Inspired by B63102A.ADA.
--
--
-- CHANGE HISTORY:
--      25 Mar 96   SAIC    Initial version for ACVC 2.1.
--      26 Feb 97   PWB.CTA Removed use of function called before elaboration
--!

with Report;

procedure C631001 is

   package C631001_0 is 

      type Int_Type is range 1 .. 100;
      type Enu_Type is ('A', 'B', 'C', 'D');

      type Private_Enu (D : Enu_Type := 'B')       is private;

      function "+" (X, Y : Int_Type) return Int_Type;

      procedure Int_Proc (P1 : in  Int_Type := "+" (10, 15);
                          P2 : out Int_Type);
                                    
      procedure Enu_Proc (P1 : in  Enu_Type := 'C';
                          P2 : out Enu_Type);

   private

      type Private_Enu (D : Enu_Type := C631001_0.'B') is              -- OK.
        record
           C2 : Enu_Type := D;
        end record;

      -----------------------------------------------------------------
      PE_Obj  : C631001_0.Private_Enu;

   end C631001_0;

     --==================================================================--

   package body C631001_0 is 

      function "+" (X, Y : Int_Type) return Int_Type is
      begin
         return 10;
      end "+";

      -----------------------------------------------------------------
      procedure Int_Proc (P1 : in  Int_Type := C631001_0."+" (10, 15); -- OK.
                          P2 : out Int_Type) is
                                    
      begin
         P2 := P1;
      end Int_Proc;

      -----------------------------------------------------------------
      procedure Enu_Proc (P1 : in  Enu_Type := C631001_0.'C';          -- OK.
                          P2 : out Enu_Type) is
      begin
         P2 := P1;
      end Enu_Proc;

      -----------------------------------------------------------------

   end C631001_0;

   ---------------------------------------------------------------------------
   Int_Obj : C631001_0.Int_Type := 50;
   Enu_Obj : C631001_0.Enu_Type := C631001_0.'D';

   -- Direct visibility to operator symbols
   use type C631001_0.Int_Type;
   use type C631001_0.Enu_Type;

begin  -- main

   Report.Test ("C631001", "Check that if different forms of a name are " &
                "used in the default expression of a discriminant part, " &
                "the selector may be an operator symbol or a character "  &
                "literal");

   C631001_0.Int_Proc (P2 => Int_Obj);

   if Int_Obj /= 10 then
     Report.Failed ("Wrong result for Int_Obj");
   end if;

   C631001_0.Enu_Proc (P2 => Enu_Obj);

   if Enu_Obj /= 'C' then
     Report.Failed ("Wrong result for Enu_Obj");
   end if;

   Report.Result;

end C631001;