summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/using-directive.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-05 19:25:20 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-05 19:25:20 +0000
commit700792c4e45d53996209f401020c3849c0ca5cea (patch)
tree53402ff5117bdf8bd894091596e3e35c69abeba0 /clang/test/SemaCXX/using-directive.cpp
parent5922e26d1a6e20072ee23ee77bc54656fa289c52 (diff)
downloadbcm5719-llvm-700792c4e45d53996209f401020c3849c0ca5cea.tar.gz
bcm5719-llvm-700792c4e45d53996209f401020c3849c0ca5cea.zip
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). llvm-svn: 63877
Diffstat (limited to 'clang/test/SemaCXX/using-directive.cpp')
-rw-r--r--clang/test/SemaCXX/using-directive.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/using-directive.cpp b/clang/test/SemaCXX/using-directive.cpp
index e258586491f..d861f50f79f 100644
--- a/clang/test/SemaCXX/using-directive.cpp
+++ b/clang/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}}
+ }
+}
OpenPOWER on IntegriCloud