blob: 767b49b76f3f0e53e6d5636ef5c1e69c841222b9 [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s
Sebastian Redlddf7e992009-02-08 10:28:44 +00002// XFAIL
3// fails due to exact diagnostic matching
Douglas Gregor2a3009a2009-02-03 19:21:40 +00004
5namespace A {
6 short i; // expected-note{{candidate found by name lookup is 'A::i'}}
7 namespace B {
8 long i; // expected-note{{candidate found by name lookup is 'A::B::i'}}
9 void f() {} // expected-note{{candidate function}}
10 int k;
11 namespace E {} // \
12 expected-note{{candidate found by name lookup is 'A::B::E'}}
13 }
14
15 namespace E {} // expected-note{{candidate found by name lookup is 'A::E'}}
16
17 namespace C {
18 using namespace B;
19 namespace E {} // \
20 expected-note{{candidate found by name lookup is 'A::C::E'}}
21 }
22
23 void f() {} // expected-note{{candidate function}}
24
25 class K1 {
26 void foo();
27 };
28
29 void local_i() {
30 char i;
31 using namespace A;
32 using namespace B;
33 int a[sizeof(i) == sizeof(char)? 1 : -1]; // okay
34 }
35 namespace B {
36 int j;
37 }
38
39 void ambig_i() {
40 using namespace A;
41 using namespace A::B;
42 (void) i; // expected-error{{reference to 'i' is ambiguous}}
43 f(); // expected-error{{call to 'f' is ambiguous}}
44 (void) j; // okay
45 using namespace C;
46 (void) k; // okay
47 using namespace E; // expected-error{{reference to 'E' is ambiguous}}
48 }
49
50 struct K2 {}; // expected-note{{candidate found by name lookup is 'A::K2'}}
51}
52
53struct K2 {}; // expected-note{{candidate found by name lookup is 'K2'}}
54
55using namespace A;
56
57void K1::foo() {} // okay
58
59// FIXME: Do we want err_ovl_no_viable_function_in_init here?
60struct K2 k2; // expected-error{{reference to 'K2' is ambiguous}} \
61 expected-error{{no matching constructor}}
62
63// FIXME: This case is incorrectly diagnosed!
64//K2 k3;
65
66
Douglas Gregor7dda67d2009-02-05 19:25:20 +000067class X { // expected-note{{candidate found by name lookup is 'X'}}
Douglas Gregor2a3009a2009-02-03 19:21:40 +000068 // FIXME: produce a suitable error message for this
69 using namespace A; // expected-error{{expected unqualified-id}}
70};
71
72namespace N {
Douglas Gregore2c565d2009-02-03 19:26:08 +000073 struct K2;
74 struct K2 { };
Douglas Gregor2a3009a2009-02-03 19:21:40 +000075}
Douglas Gregor7dda67d2009-02-05 19:25:20 +000076
77namespace Ni {
78 int i(); // expected-note{{candidate found by name lookup is 'Ni::i'}}
79}
80
81namespace NiTest {
82 using namespace A;
83 using namespace Ni;
84
85 int test() {
86 return i; // expected-error{{reference to 'i' is ambiguous}}
87 }
88}
89
90namespace OneTag {
91 struct X; // expected-note{{candidate found by name lookup is 'OneTag::X'}}
92}
93
94namespace OneFunction {
95 void X(); // expected-note{{candidate found by name lookup is 'OneFunction::X'}}
96}
97
98namespace TwoTag {
99 struct X; // expected-note{{candidate found by name lookup is 'TwoTag::X'}}
100}
101
102namespace FuncHidesTagAmbiguity {
103 using namespace OneTag;
104 using namespace OneFunction;
105 using namespace TwoTag;
106
107 void test() {
108 (void)X(); // expected-error{{reference to 'X' is ambiguous}}
109 }
110}