Debian Codegraph @

gcc/testsuite/g++.dg/lookup/koenig5.C

raw
1 // Koenig lookup is not defined as intended in the std. DR 218 gives
2 // an indication of what is meant. This test case encapsulates the
3 // current conservative behavior
4
5 // Copyright (C) 2006 Free Software Foundation, Inc.
6 // Contributed by Nathan Sidwell 27 Aug 2006 <[email protected]>
7
8 namespace N
9 {
10 struct A {};
11 void One (...); // { dg-message "N::One" }
12 void (*Two) (...); // { dg-message "N::Two" }
13 namespace Three {} // { dg-message "N::Three" }
14 }
15
16 namespace M
17 {
18 struct B {};
19 struct One {}; // { dg-message "M::One" }
20 void (*Two) (...); // { dg-message "M::Two" }
21 void Three (...); // { dg-message "M::Three" }
22 }
23
24 namespace O
25 {
26 struct C {};
27 void Two (...); // { dg-message "O::Two" }
28 }
29
30 void g (N::A *a, M::B *b, O::C *c)
31 {
32 One (a); // ok
33 One (a, b); // ok
34 One (b); // { dg-error "3:'One' was not declared" }
35 // { dg-message "suggested alternatives" "suggested alternative for One" { target *-*-* } .-1 }
36
37 Two (c); // ok
38 Two (a, c); // ok
39 Two (a); // { dg-error "3:'Two' was not declared" }
40 // { dg-message "suggested alternatives" "suggested alternative for Two" { target *-*-* } .-1 }
41 Two (a, a); // error masked by earlier error
42 Two (b); // error masked by earlier error
43 Two (a, b); // error masked by earlier error
44
45 Three (b); // ok
46 Three (a, b); // ok
47 Three (a); // { dg-error "3:'Three' was not declared" }
48 // { dg-message "suggested alternatives" "suggested alternative for Three" { target *-*-* } .-1 }
49 }