summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/using-decl-1.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-01-26 07:16:45 +0000
committerJohn McCall <rjmccall@apple.com>2010-01-26 07:16:45 +0000
commit8fe6808de0d1bd29b4c1f51ceb1442ee21fa0fa1 (patch)
tree3c04d80f5a65590cfc2ff889947e0cca2bf111ca /clang/test/SemaCXX/using-decl-1.cpp
parent547c761dd6578896a80e649d2ca4ec4446ea3e44 (diff)
downloadbcm5719-llvm-8fe6808de0d1bd29b4c1f51ceb1442ee21fa0fa1.tar.gz
bcm5719-llvm-8fe6808de0d1bd29b4c1f51ceb1442ee21fa0fa1.zip
Handle redeclarations found by ADL deterministically and reasonably.
This solution relies on an O(n) scan of redeclarations, which means it might scale poorly in crazy cases with tons of redeclarations brought in by a ton of distinct associated namespaces. I believe that avoiding this is not worth the common-case cost. llvm-svn: 94530
Diffstat (limited to 'clang/test/SemaCXX/using-decl-1.cpp')
-rw-r--r--clang/test/SemaCXX/using-decl-1.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/using-decl-1.cpp b/clang/test/SemaCXX/using-decl-1.cpp
index eb41e6630fe..30c4cfd997a 100644
--- a/clang/test/SemaCXX/using-decl-1.cpp
+++ b/clang/test/SemaCXX/using-decl-1.cpp
@@ -77,3 +77,21 @@ namespace test0 {
foo(*p); // expected-error {{no matching function for call to 'foo'}}
}
}
+
+// Redeclarations!
+namespace test1 {
+ namespace ns0 { struct Foo {}; }
+ namespace A { void foo(ns0::Foo *p, int y, int z); }
+ namespace ns2 { using A::foo; }
+ namespace ns1 { struct Bar : ns0::Foo {}; }
+ namespace A { void foo(ns0::Foo *p, int y, int z = 0); } // expected-note {{candidate}}
+ namespace ns1 { using A::foo; }
+ namespace ns2 { struct Baz : ns1::Bar {}; }
+ namespace A { void foo(ns0::Foo *p, int y = 0, int z); }
+
+ void test(ns2::Baz *p) {
+ foo(p, 0, 0); // okay!
+ foo(p, 0); // should be fine!
+ foo(p); // expected-error {{no matching function}}
+ }
+}
OpenPOWER on IntegriCloud