1 // { dg-options "-fdiagnostics-show-caret" }
3 /* Various tests of name lookup within a namespace, both within an explicitly
4 given namespace, or implicitly. */
7 /* Various things to look for. */
9 typedef int some_typedef;
11 int _foo(int i) { return i; }
14 T something_else (T i) { return i; }
17 /* Tests of lookup of a typedef. */
21 detail::some_type i; // { dg-error ".some_type. is not a member of .detail.; did you mean 'some_typedef'\\?" }
22 /* { dg-begin-multiline-output "" }
26 { dg-end-multiline-output "" } */
33 some_type i; // { dg-error ".some_type. was not declared in this scope; did you mean 'some_typedef'\\?" }
34 /* { dg-begin-multiline-output "" }
38 { dg-end-multiline-output "" } */
44 /* Tests of lookup of a function. */
46 void fn_2_explicit (int i) {
47 detail::foo(i); // { dg-error ".foo. is not a member of .detail.; did you mean '_foo'\\?" }
48 /* { dg-begin-multiline-output "" }
52 { dg-end-multiline-output "" } */
57 void fn_2_implicit (int i) {
58 foo(i); // { dg-error ".foo. was not declared in this scope; did you mean '_foo'\\?" }
59 /* { dg-begin-multiline-output "" }
63 { dg-end-multiline-output "" } */
69 /* Examples using a template. */
71 void fn_3_explicit (int i) {
72 detail::something_els(i); // { dg-error ".something_els. is not a member of .detail.; did you mean 'something_else'\\?" }
73 /* { dg-begin-multiline-output "" }
74 detail::something_els(i);
77 { dg-end-multiline-output "" } */
82 void fn_3_implicit (int i) {
83 something_els(i); // { dg-error ".something_els. was not declared in this scope; did you mean 'something_else'\\?" }
84 /* { dg-begin-multiline-output "" }
88 { dg-end-multiline-output "" } */
94 /* Tests of lookup for which no hint is available. */
96 void fn_4_explicit (int i) {
97 detail::not_recognized(i); // { dg-error ".not_recognized. is not a member of .detail." }
98 /* { dg-begin-multiline-output "" }
99 detail::not_recognized(i);
101 { dg-end-multiline-output "" } */
106 void fn_4_implicit (int i)
108 not_recognized(i); // { dg-error ".not_recognized. was not declared in this scope" }
109 /* { dg-begin-multiline-output "" }
112 { dg-end-multiline-output "" } */
115 } // namespace detail
118 /* Test for failed lookup explicitly within global namespace. */
120 typedef int another_typedef;
124 ::another_type i; // { dg-error ".::another_type. has not been declared; did you mean 'another_typedef'\\?" }
125 /* { dg-begin-multiline-output "" }
129 { dg-end-multiline-output "" } */