diff options
Diffstat (limited to 'test/SemaCXX/using-decl-1.cpp')
-rw-r--r-- | test/SemaCXX/using-decl-1.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/SemaCXX/using-decl-1.cpp b/test/SemaCXX/using-decl-1.cpp index e8a7d70976ec..30c4cfd997a1 100644 --- a/test/SemaCXX/using-decl-1.cpp +++ b/test/SemaCXX/using-decl-1.cpp @@ -60,3 +60,38 @@ namespace P { g(f); } } + +// Make sure that ADL can find names brought in by using decls. +namespace test0 { + namespace ns { + class Foo {}; + + namespace inner { + void foo(char *); // expected-note {{no known conversion}} + } + + using inner::foo; + } + + void test(ns::Foo *p) { + 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}} + } +} |