]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.cp/rvalue-ref-casts.cc
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / rvalue-ref-casts.cc
CommitLineData
c0f55cc6
AV
1/* This testcase is part of GDB, the GNU debugger.
2
213516ef 3 Copyright 2002-2023 Free Software Foundation, Inc.
c0f55cc6
AV
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/* Rvalue references casting tests, based on casts.cc. */
19
20#include <utility>
21
22struct A
23{
24 int a;
25 A (int aa): a (aa) {}
26};
27
28struct B: public A
29{
30 int b;
31 B (int aa, int bb): A (aa), b (bb) {}
32};
33
34
35struct Alpha
36{
37 virtual void x () { }
38};
39
40struct Gamma
41{
42};
43
44struct Derived : public Alpha
45{
46};
47
48struct VirtuallyDerived : public virtual Alpha
49{
50};
51
52struct DoublyDerived : public VirtuallyDerived,
53 public virtual Alpha,
54 public Gamma
55{
56};
57
58int
59main (int argc, char **argv)
60{
61 A *a = new B (42, 1729);
62 B *b = (B *) a;
63 A &ar = *b;
64 B &br = (B&)ar;
65 A &&arr = std::move (A (42));
66 B &&brr = std::move (B (42, 1729));
67
68 Derived derived;
69 DoublyDerived doublyderived;
70
71 Alpha *ad = &derived;
72 Alpha *add = &doublyderived;
73
74 return 0; /* breakpoint spot: rvalue-ref-casts.exp: 1 */
75}