]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.cp/member-name.cc
Update copyright year range in all GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / member-name.cc
1 /* This testcase is part of GDB, the GNU debugger.
2
3 Copyright 2003-2020 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 struct B
19 {
20 static int b;
21 };
22
23 int B::b = 23;
24
25 struct C : public B
26 {
27 static int x;
28
29 struct inner
30 {
31 static int z;
32 };
33
34 int y;
35
36 C ()
37 {
38 // First breakpoint here
39 y = x + inner::z;
40 }
41
42 int m ()
43 {
44 // Second breakpoint here
45 return x - y;
46 }
47 };
48
49 int C::x = 23;
50 int C::inner::z = 0;
51
52 template<typename T>
53 struct Templ
54 {
55 static int y;
56
57 int m()
58 {
59 // Third breakpoint here
60 return Templ::y;
61 }
62 };
63
64 template<typename T> int Templ<T>::y = 23;
65
66 int main ()
67 {
68 C c;
69 Templ<int> t;
70
71 return c.m() + t.m();
72 }