Debian Codegraph @

clang/test/CXX/basic/basic.lookup/basic.lookup.argdep/p3.cpp

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2
3 // FIXME: embellish
4
5 namespace test0 {
6 namespace A {
7 class Foo {
8 };
9
10 void foo(const Foo &foo);
11 }
12
13 class Test {
14 enum E { foo = 0 };
15
16 void test() {
17 foo(A::Foo()); // expected-error {{not a function}}
18 }
19 };
20 }
21
22 // If X contains [...] then Y is empty.
23 // - a declaration of a class member
24 namespace test_adl_suppression_by_class_member {
25 namespace N {
26 struct T {};
27 void f(T); // expected-note {{declared here}}
28 }
29 struct S {
30 void f();
31 void test() {
32 N::T t;
33 f(t); // expected-error {{too many arguments}}
34 }
35 };
36 }
37
38 // - a block-scope function declaration that is not a using-declaration
39 namespace test_adl_suppression_by_block_scope {
40 namespace N {
41 struct S {};
42 void f(S);
43 }
44 namespace M { void f(int); } // expected-note 2{{candidate}}
45 void test1() {
46 N::S s;
47 using M::f;
48 f(s); // ok
49 }
50
51 void test2() {
52 N::S s;
53 extern void f(char); // expected-note {{passing argument to parameter here}}
54 f(s); // expected-error {{no viable conversion from 'N::S' to 'char'}}
55 }
56
57 void test3() {
58 N::S s;
59 extern void f(char); // expected-note {{candidate}}
60 using M::f;
61 f(s); // expected-error {{no matching function}}
62 }
63
64 void test4() {
65 N::S s;
66 using M::f;
67 extern void f(char); // expected-note {{candidate}}
68 f(s); // expected-error {{no matching function}}
69 }
70
71 }
72
73 // - a declaration that is neither a function nor a function template
74 namespace test_adl_suppression_by_non_function {
75 namespace N {
76 struct S {};
77 void f(S);
78 }
79 void test() {
80 extern void (*f)();
81 N::S s;
82 f(s); // expected-error {{too many arguments}}
83 }
84 }