]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.cp/rvalue-ref-types.cc
Update copyright year range in all GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / rvalue-ref-types.cc
1 /* This test script is part of GDB, the GNU debugger.
2
3 Copyright 1999-2019 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 /* Tests for reference types with short type variables in GDB, based on
19 gdb.cp/ref-types.cc. */
20
21 #include <utility>
22
23 int main2 ();
24
25 void
26 marker1 ()
27 {
28 }
29
30 int
31 main ()
32 {
33 short t = -1;
34 short *pt;
35 short &&rrt = std::move (t);
36 pt = &rrt;
37
38 short *&&rrpt = std::move (pt);
39 short at[4];
40 at[0] = 0;
41 at[1] = 1;
42 at[2] = 2;
43 at[3] = 3;
44
45 short (&&rrat)[4] = std::move( at);
46
47 marker1();
48
49 main2();
50
51 return 0;
52 }
53
54 int
55 f ()
56 {
57 int f1;
58 f1 = 1;
59 return f1;
60 }
61
62 int
63 main2 ()
64 {
65 char &&rrC = 'A';
66 unsigned char &&rrUC = 21;
67 short &&rrS = -14;
68 unsigned short &&rrUS = 7;
69 int &&rrI = 102;
70 unsigned int &&rrUI = 1002;
71 long &&rrL = -234;
72 unsigned long &&rrUL = 234;
73 float &&rrF = 1.25E10;
74 double &&rrD = -1.375E-123;
75
76 f ();
77
78 return 0;
79 }