ignore invalid DOF provider sections
[binutils-gdb.git] / gdb / testsuite / gdb.cp / chained-calls.cc
blob1a186cb803b7155943968a5692a43ff7a454329f
1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2014-2015 Free Software Foundation, Inc.
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.
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.
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/>. */
18 class S
20 public:
21 S () { }
22 S (S &obj);
24 S operator+ (const S &s);
26 int a;
29 S::S (S &obj)
31 a = obj.a;
35 S::operator+ (const S &s)
37 S res;
39 res.a = a + s.a;
41 return res;
45 f (int i)
47 S s;
49 s.a = i;
51 return s;
54 int
55 g (const S &s)
57 return s.a;
60 class A
62 public:
63 A operator+ (const A &);
64 int a;
68 A::operator+ (const A &obj)
70 A n;
72 n.a = a + obj.a;
74 return n;
78 p ()
80 A a;
81 a.a = 12345678;
82 return a;
86 r ()
88 A a;
89 a.a = 10000000;
90 return a;
94 q (const A &a)
96 return a;
99 class B
101 public:
102 int b[1024];
106 makeb ()
108 B b;
109 int i;
111 for (i = 0; i < 1024; i++)
112 b.b[i] = i;
114 return b;
118 getb (const B &b, int i)
120 return b.b[i];
123 class C
125 public:
126 C ();
127 ~C ();
129 A operator* ();
131 A *a_ptr;
134 C::C ()
136 a_ptr = new A;
137 a_ptr->a = 5678;
140 C::~C ()
142 delete a_ptr;
146 C::operator* ()
148 return *a_ptr;
151 #define TYPE_INDEX 1
153 enum type
155 INT,
156 CHAR
159 union U
161 public:
162 U (type t);
163 type get_type ();
165 int a;
166 char c;
167 type tp[2];
170 U::U (type t)
172 tp[TYPE_INDEX] = t;
176 make_int ()
178 return U (INT);
182 make_char ()
184 return U (CHAR);
187 type
188 U::get_type ()
190 return tp[TYPE_INDEX];
194 main ()
196 int i = g(f(0));
197 A a = q(p() + r());
199 B b = makeb ();
200 C c;
202 return i + getb(b, 0); /* Break here */