Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.compile / compile-cplus-nested.cc
CommitLineData
88b9d363 1/* Copyright 2015-2022 Free Software Foundation, Inc.
078a0207
KS
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 3 of the License, or
6 (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */
15
16class A
17{
18public:
19 A () : a_ (1) {}
20 int get ();
21
22protected:
23 int a_;
24
25private:
26 /* It is important to not /not/ use the nested class definition in A.
27 This exercises a different path through the code. */
28 struct Inner1
29 {
30 int a_;
31 Inner1 () : a_ (2) {}
32
33 struct Inner2
34 {
35 int a_;
36 Inner2 () : a_ (3) {}
37 };
38 };
39};
40
41int
42A::get ()
43{
44 A::Inner1 i1;
45 A::Inner1::Inner2 i2;
46
47 return i1.a_ + i2.a_; // break here
48}
49
50int var = 1234;
51
52int
53main ()
54{
55 A a;
56
57 return a.get ();
58}
This page took 0.408204 seconds and 4 git commands to generate.