diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-05 19:25:20 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-05 19:25:20 +0000 |
commit | 7dda67d8decef1b3621a151488c4b83bd8372d6a (patch) | |
tree | 5a2998b8ddf8f1d99036fe2127146dafdecac24f /test/SemaCXX/using-directive.cpp | |
parent | 399f5dd0c8d383d60f4dc71bef73960a334d4b5f (diff) |
Improvements and fixes for name lookup with using directives, from Piotr Rak!
Also, put Objective-C protocols into their own identifier
namespace. Otherwise, we find protocols when we don't want to in C++
(but not in C).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63877 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/using-directive.cpp')
-rw-r--r-- | test/SemaCXX/using-directive.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/test/SemaCXX/using-directive.cpp b/test/SemaCXX/using-directive.cpp index e258586491..d861f50f79 100644 --- a/test/SemaCXX/using-directive.cpp +++ b/test/SemaCXX/using-directive.cpp @@ -62,7 +62,7 @@ struct K2 k2; // expected-error{{reference to 'K2' is ambiguous}} \ //K2 k3; -class X { +class X { // expected-note{{candidate found by name lookup is 'X'}} // FIXME: produce a suitable error message for this using namespace A; // expected-error{{expected unqualified-id}} }; @@ -71,3 +71,38 @@ namespace N { struct K2; struct K2 { }; } + +namespace Ni { + int i(); // expected-note{{candidate found by name lookup is 'Ni::i'}} +} + +namespace NiTest { + using namespace A; + using namespace Ni; + + int test() { + return i; // expected-error{{reference to 'i' is ambiguous}} + } +} + +namespace OneTag { + struct X; // expected-note{{candidate found by name lookup is 'OneTag::X'}} +} + +namespace OneFunction { + void X(); // expected-note{{candidate found by name lookup is 'OneFunction::X'}} +} + +namespace TwoTag { + struct X; // expected-note{{candidate found by name lookup is 'TwoTag::X'}} +} + +namespace FuncHidesTagAmbiguity { + using namespace OneTag; + using namespace OneFunction; + using namespace TwoTag; + + void test() { + (void)X(); // expected-error{{reference to 'X' is ambiguous}} + } +} |