Imported Upstream version 7.9
[platform/upstream/gdb.git] / gdb / testsuite / gdb.cp / ref-types.cc
1 /* This test script is part of GDB, the GNU debugger.
2
3    Copyright 1999-2015 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18 int main2(void);
19
20 void marker1 (void)
21 {
22     
23 }
24
25
26
27 int main(void)
28 {
29     short s;
30     short &rs = s;
31     short *ps;
32     short *&rps = ps;
33     short as[4];
34     short (&ras)[4] = as;
35     s = -1;
36     ps = &s;
37     as[0] = 0;
38     as[1] = 1;
39     as[2] = 2;
40     as[3] = 3;
41
42     marker1();
43
44     main2();
45
46     return 0;
47 }
48
49 int f()
50 {
51     int f1;
52     f1 = 1;
53     return f1;
54 }
55
56 int main2(void)
57 {
58     char C;
59     unsigned char UC;
60     short S;
61     unsigned short US;
62     int I;
63     unsigned int UI;
64     long L;
65     unsigned long UL;
66     float F;
67     double D;
68     char &rC = C;
69     unsigned char &rUC = UC;
70     short &rS = S;
71     unsigned short &rUS = US;
72     int &rI = I;
73     unsigned int &rUI = UI;
74     long &rL = L;
75     unsigned long &rUL = UL;
76     float &rF = F;
77     double &rD = D;
78     C = 'A';
79     UC = 21;
80     S = -14;
81     US = 7;
82     I = 102;
83     UI = 1002;
84     L = -234;
85     UL = 234;
86     F = 1.25E10;
87     D = -1.375E-123;
88     I = f();
89
90     return 0;
91     
92 }