]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.cp/anon-ns.cc
* elfxx-tilegx.c (tilegx_elf_relocate_section): Silence bogus warning.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / anon-ns.cc
1 /* This testcase is part of GDB, the GNU debugger.
2
3 Copyright 2011-2012 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 Contributed by Red Hat, originally written by Keith Seitz. */
19
20 #include <stdlib.h>
21
22 namespace
23 {
24 void doit1 (void) { } // doit1(void)
25 void doit1 (int a) { } // doit1(int)
26 void doit1 (char *a) { } // doit1(char *)
27
28 class one
29 {
30 public:
31 one (void) { } // one::one(void)
32 one (int a) { } // one::one(int)
33 one (char *a) { } // one::one(char *)
34 static void doit (void) { } // one::doit(void)
35 };
36
37 namespace A
38 {
39 void doit2 (void) { } // A::doit2(void)
40 void doit2 (int a) { } // A::doit2(int)
41 void doit2 (char *a) { } // A::doit2(char *)
42
43 class two
44 {
45 public:
46 two (void) { } // A::two::two(void)
47 two (int a) { } // A::two::two(int)
48 two (char *a) { } // A::two::two(char *)
49 static void doit (void) { } // A::two::doit(void)
50 };
51
52 namespace
53 {
54 namespace
55 {
56 void doit3 (void) { } // A::doit3(void)
57 void doit3 (int a) { } // A::doit3(int)
58 void doit3 (char *a) { } // A::doit3(char *)
59
60 class three
61 {
62 public:
63 three (void) { } // A::three::three(void)
64 three (int a) { } // A::three::three(int)
65 three (char *a) { } // A::three::three(char *)
66 static void doit (void) { } // A::three::doit(void)
67 };
68 }
69 }
70 }
71 }
72
73 int
74 main (void)
75 {
76 one a, b (3), c (static_cast<char *> (NULL));
77 one::doit ();
78 A::two d, e (3), f (static_cast<char *> (NULL));
79 A::two::doit ();
80 A::three g, h (3), i (static_cast<char *> (NULL));
81 A::three::doit ();
82 doit1 ();
83 doit1 (3);
84 doit1 (static_cast<char *> (NULL));
85 A::doit2 ();
86 A::doit2 (3);
87 A::doit2 (static_cast<char *> (NULL));
88 A::doit3 ();
89 A::doit3 (3);
90 A::doit3 (static_cast<char *> (NULL));
91 return 0;
92 }