From: John McCall Date: Tue, 17 Nov 2009 08:57:02 +0000 (+0000) Subject: Commit this random test case. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=48270a36749b7f10677a514a03bbd2cf90697d58;p=clang Commit this random test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89068 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp new file mode 100644 index 0000000000..692ae8f4c1 --- /dev/null +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp @@ -0,0 +1,44 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// We have to avoid ADL for this test. + +template class test {}; + +class foo {}; +test<0> foo(foo); // expected-note {{candidate}} + +namespace A { + class foo { int x; }; + test<1> foo(class foo); + + namespace B { + test<2> foo(class ::foo); // expected-note {{candidate}} + + void test0() { + using ::foo; + + class foo a; + test<0> _ = (foo)(a); + } + + void test1() { + using A::foo; + + class foo a; + test<1> _ = (foo)(a); + }; + + void test2() { + class ::foo a; + + // Argument-dependent lookup is ambiguous between B:: and ::. + test<0> _0 = foo(a); // expected-error {{call to 'foo' is ambiguous}} + + // But basic unqualified lookup is not. + test<2> _1 = (foo)(a); + + class A::foo b; + test<2> _2 = (foo)(b); // expected-error {{incompatible type passing}} + } + } +}