Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.linespec / cp-replace-typedefs-ns-template.cc
CommitLineData
f68f85b5
PA
1/* This testcase is part of GDB, the GNU debugger.
2
88b9d363 3 Copyright 2019-2022 Free Software Foundation, Inc.
f68f85b5
PA
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
18namespace NS1 {
19
20namespace NS2 {
21
22struct object
23{
24 object ()
25 {
26 }
27};
28
29typedef object *object_p;
30
31template<typename T>
32struct Templ1
33{
34 explicit Templ1 (object_p)
35 {
36 }
37
38 template<typename I>
39 static void
40 static_method (object_p)
41 {
42 }
43};
44
45template<typename T, typename U>
46struct Templ2
47{
48 explicit Templ2 (object_p)
49 {
50 }
51
52 template<typename I>
53 static void
54 static_method (object_p)
55 {
56 }
57};
58
59template<typename T> using AliasTempl = Templ2<int, T>;
60
61typedef Templ1<int> int_Templ1_t;
62
63void
64object_p_func (object_p)
65{
66}
67
68void
69int_Templ1_t_func (int_Templ1_t *)
70{
71}
72
73} // namespace NS2
74
75} // namespace NS1
76
77/* These typedefs have the same name as some of the components within
78 NS1 that they alias to, on purpose, to try to confuse GDB and cause
79 recursion. */
80using NS2 = int;
81using object = NS1::NS2::object;
82using Templ1 = NS1::NS2::Templ1<unsigned>;
83using Templ2 = NS1::NS2::Templ2<long, long>;
84using AliasTempl = NS1::NS2::AliasTempl<int>;
85
86NS2 ns2_int = 0;
87object obj;
88Templ1 templ1 (0);
89NS1::NS2::int_Templ1_t int_templ1 (0);
90AliasTempl alias (0);
91
92int
93main ()
94{
95 NS1::NS2::Templ1<int>::static_method<int> (0);
96 NS1::NS2::AliasTempl<int>::static_method<int> (0);
97 NS1::NS2::object_p_func (0);
98 NS1::NS2::int_Templ1_t_func (0);
99
100 return 0;
101}
This page took 0.182242 seconds and 4 git commands to generate.