1 // RUN: %clang_cc1 -fsyntax-only -verify %s
4 short i
; // expected-note 2{{candidate found by name lookup is 'A::i'}}
6 long i
; // expected-note{{candidate found by name lookup is 'A::B::i'}}
7 void f() {} // expected-note{{candidate function}}
10 expected
-note
{{candidate found by name lookup is
'A::B::E'}}
13 namespace E
{} // expected-note{{candidate found by name lookup is 'A::E'}}
18 expected
-note
{{candidate found by name lookup is
'A::C::E'}}
21 void f() {} // expected-note{{candidate function}}
31 int a
[sizeof(i
) == sizeof(char)? 1 : -1]; // okay
40 (void) i
; // expected-error{{reference to 'i' is ambiguous}}
41 f(); // expected-error{{call to 'f' is ambiguous}}
45 using namespace E
; // expected-error{{reference to 'E' is ambiguous}}
48 struct K2
{}; // expected-note 2{{candidate found by name lookup is 'A::K2'}}
51 struct K2
{}; // expected-note 2{{candidate found by name lookup is 'K2'}}
55 void K1::foo() {} // okay
57 struct K2
*k2
; // expected-error{{reference to 'K2' is ambiguous}}
59 K2
*k3
; // expected-error{{reference to 'K2' is ambiguous}}
61 class X
{ // expected-note{{candidate found by name lookup is 'X'}}
62 // FIXME: produce a suitable error message for this
63 using namespace A
; // expected-error{{not allowed}}
72 int i(); // expected-note{{candidate found by name lookup is 'Ni::i'}}
80 return i
; // expected-error{{reference to 'i' is ambiguous}}
85 struct X
; // expected-note{{candidate found by name lookup is 'OneTag::X'}}
88 namespace OneFunction
{
89 void X(); // expected-note{{candidate found by name lookup is 'OneFunction::X'}}
93 struct X
; // expected-note{{candidate found by name lookup is 'TwoTag::X'}}
96 namespace FuncHidesTagAmbiguity
{
97 using namespace OneTag
;
98 using namespace OneFunction
;
99 using namespace TwoTag
;
102 (void)X(); // expected-error{{reference to 'X' is ambiguous}}
110 namespace Alias
= Aliased
;
111 using namespace Alias
;
116 namespace N
{ void f2(int); }
126 using namespace std
; // expected-warning{{using directive refers to implicitly-defined namespace 'std'}}
127 using namespace ::std
; // expected-warning{{using directive refers to implicitly-defined namespace 'std'}}
130 namespace ns
{ typedef int test1
; }
131 template <class T
> using namespace ns
; // expected-error {{cannot template a using directive}}
133 // Test that we recovered okay.