]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.cp/member-name.cc
Automatic Copyright Year update after running gdb/copyright.py
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / member-name.cc
CommitLineData
6592e36f
TT
1/* This testcase is part of GDB, the GNU debugger.
2
4a94e368 3 Copyright 2003-2022 Free Software Foundation, Inc.
6592e36f
TT
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
47d48711 16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
6592e36f
TT
17
18struct B
19{
20 static int b;
21};
22
23int B::b = 23;
24
25struct 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
49int C::x = 23;
50int C::inner::z = 0;
51
52template<typename T>
53struct Templ
54{
55 static int y;
56
57 int m()
58 {
59 // Third breakpoint here
60 return Templ::y;
61 }
62};
63
64template<typename T> int Templ<T>::y = 23;
65
66int main ()
67{
68 C c;
69 Templ<int> t;
70
71 return c.m() + t.m();
72}