1 /* Example of namespace suggestions, covering the special-case handling
2 of where there's one suggestion, vs multiple suggestions. */
4 /* { dg-options "-fdiagnostics-show-caret" } */
6 /* Missing a namespace, where there's one candidate.
7 Verify that we issue a fix-it hint. */
11 void foo_1 (); // { dg-line foo_1_decl }
16 foo_1 (); // { dg-error "'foo_1' was not declared in this scope; did you mean 'ns1::foo_1'\\?" }
17 /* { dg-begin-multiline-output "" }
21 { dg-end-multiline-output "" } */
22 // { dg-message "'ns1::foo_1' declared here" "" { target *-*-*} foo_1_decl }
23 /* { dg-begin-multiline-output "" }
26 { dg-end-multiline-output "" } */
29 /* Missing a namespace, where there are multiple candidates.
30 We don't issue a fix-it hint. */
34 char foo_2 (); // { dg-line ns2_a_foo_2_decl }
39 int foo_2 (); // { dg-line ns2_b_foo_2_decl }
44 foo_2 (); // { dg-line foo_2_usage }
45 // { dg-error "'foo_2' was not declared in this scope" "" { target *-*-*} foo_2_usage }
46 /* { dg-begin-multiline-output "" }
49 { dg-end-multiline-output "" } */
50 // { dg-message "suggested alternatives:" "" { target *-*-*} foo_2_usage }
51 // { dg-message " 'ns2_a::foo_2'" "" { target *-*-*} ns2_a_foo_2_decl }
52 /* { dg-begin-multiline-output "" }
55 { dg-end-multiline-output "" } */
56 // { dg-message " 'ns2_b::foo_2'" "" { target *-*-*} ns2_b_foo_2_decl }
57 /* { dg-begin-multiline-output "" }
60 { dg-end-multiline-output "" } */
63 /* Misspelling within an explicit namespace.
64 Verify that we issue a fix-it hint. */
73 ns3::goo_3 (); // { dg-error "'goo_3' is not a member of 'ns3'; did you mean 'foo_3'\\?" }
74 /* { dg-begin-multiline-output "" }
78 { dg-end-multiline-output "" } */