Whitelist flex 2.5.34.
[lestes.git] / tests / compile / 3.4.3.2_2-namespaces-a.cc
blob37cf0d285ee298da56df27cf82119506c884b69c
1 /*
2 The lestes compiler suite
3 Copyright (C) 2002, 2003, 2004, 2005 Miroslav Tichy
4 Copyright (C) 2002, 2003, 2004, 2005 Petr Zika
5 Copyright (C) 2002, 2003, 2004, 2005 Vojtech Hala
6 Copyright (C) 2002, 2003, 2004, 2005 Jiri Kosina
7 Copyright (C) 2002, 2003, 2004, 2005 Pavel Sanda
8 Copyright (C) 2002, 2003, 2004, 2005 Jan Zouhar
9 Copyright (C) 2002, 2003, 2004, 2005 Rudolf Thomas
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; version 2 of the License.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 See the full text of the GNU General Public License version 2, and
21 the limitations in the file doc/LICENSE.
23 By accepting the license the licensee waives any and all claims
24 against the copyright holder(s) related in whole or in part to the
25 work, its use, and/or the inability to use it.
28 int x;
29 namespace Y { void f(float); void h(int); }
30 namespace Z { void h(double); }
31 namespace A { using namespace Y; void f(int); void g(int); int i; }
32 namespace B { using namespace Z; void f(char); int i; }
33 namespace AB { using namespace A; using namespace B; void g(); }
35 void h(){
36 AB::g(); // g is declared directly in AB,
37 // therefore S is { AB::g() } and AB::g() is chosen
38 AB::f(1); // f is not declared directly in AB so the rules are
39 // applied recursively to A and B;
40 // namespace Y is not searched and Y::f(float)
41 // is not considered;
42 // S is { A::f(int), B::f(char) } and overload
43 // resolution chooses A::f(int)
44 AB::f('c'); //as above but resolution chooses B::f(char)
45 AB::h(16.8); // h is not declared directly in AB and
46 // not declared directly in A or B so the rules are
47 // applied recursively to Y and Z,
48 // S is { Y::h(int), Z::h(double) } and overload
49 // resolution chooses Z::h(double)