summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-10-23 16:06:17 +0000
committerDouglas Gregor <dgregor@apple.com>2010-10-23 16:06:17 +0000
commite63d087bcb047c6c7c91076c93a459dd10d49a2a (patch)
tree4db14361debf67e39e5a9a6d3cbd9fff1e78e5e0 /clang/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp
parentc9616f26bd20e573c0a881a6d7c98584e1277af9 (diff)
downloadbcm5719-llvm-e63d087bcb047c6c7c91076c93a459dd10d49a2a.tar.gz
bcm5719-llvm-e63d087bcb047c6c7c91076c93a459dd10d49a2a.zip
C++ [basic.scope.hiding] allows an ordinary name to hide a non-tag
name *in the same scope*, but not across scopes. Implement the highlighted condition. llvm-svn: 117212
Diffstat (limited to 'clang/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp')
-rw-r--r--clang/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp b/clang/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp
new file mode 100644
index 00000000000..911df989530
--- /dev/null
+++ b/clang/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// rdar4641403
+namespace N {
+ struct X { // expected-note{{candidate found by name lookup}}
+ float b;
+ };
+}
+
+using namespace N;
+
+typedef struct {
+ int a;
+} X; // expected-note{{candidate found by name lookup}}
+
+
+struct Y { };
+void Y(int) { }
+
+void f() {
+ X *x; // expected-error{{reference to 'X' is ambiguous}}
+ Y(1); // okay
+}
+
OpenPOWER on IntegriCloud