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