Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Sebastian Redl | ddf7e99 | 2009-02-08 10:28:44 +0000 | [diff] [blame] | 2 | // XFAIL |
| 3 | // fails due to exact diagnostic matching |
Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 4 | |
| 5 | namespace 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 | |
| 53 | struct K2 {}; // expected-note{{candidate found by name lookup is 'K2'}} |
| 54 | |
| 55 | using namespace A; |
| 56 | |
| 57 | void K1::foo() {} // okay |
| 58 | |
| 59 | // FIXME: Do we want err_ovl_no_viable_function_in_init here? |
| 60 | struct 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 Gregor | 7dda67d | 2009-02-05 19:25:20 +0000 | [diff] [blame] | 67 | class X { // expected-note{{candidate found by name lookup is 'X'}} |
Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 68 | // FIXME: produce a suitable error message for this |
| 69 | using namespace A; // expected-error{{expected unqualified-id}} |
| 70 | }; |
| 71 | |
| 72 | namespace N { |
Douglas Gregor | e2c565d | 2009-02-03 19:26:08 +0000 | [diff] [blame] | 73 | struct K2; |
| 74 | struct K2 { }; |
Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 75 | } |
Douglas Gregor | 7dda67d | 2009-02-05 19:25:20 +0000 | [diff] [blame] | 76 | |
| 77 | namespace Ni { |
| 78 | int i(); // expected-note{{candidate found by name lookup is 'Ni::i'}} |
| 79 | } |
| 80 | |
| 81 | namespace 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 | |
| 90 | namespace OneTag { |
| 91 | struct X; // expected-note{{candidate found by name lookup is 'OneTag::X'}} |
| 92 | } |
| 93 | |
| 94 | namespace OneFunction { |
| 95 | void X(); // expected-note{{candidate found by name lookup is 'OneFunction::X'}} |
| 96 | } |
| 97 | |
| 98 | namespace TwoTag { |
| 99 | struct X; // expected-note{{candidate found by name lookup is 'TwoTag::X'}} |
| 100 | } |
| 101 | |
| 102 | namespace 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 | } |