blob: 67f2b650339159bb3c41e9de89a12152e5da0759 [file] [log] [blame]
Douglas Gregorfa047642009-02-04 00:32:51 +00001// RUN: clang -fsyntax-only -verify %s
2
3namespace N {
4 struct X { };
5
6 X operator+(X, X);
7
8 void f(X);
9 void g(X);
10
11 void test_multiadd(X x) {
12 (void)(x + x);
13 }
14}
15
16namespace M {
17 struct Y : N::X { };
18}
19
20void f();
21
22void test_operator_adl(N::X x, M::Y y) {
23 (void)(x + x);
24 (void)(y + y);
25}
26
27void test_func_adl(N::X x, M::Y y) {
28 f(x);
29 f(y);
30 (f)(x); // expected-error{{too many arguments to function call}}
31 ::f(x); // expected-error{{too many arguments to function call}}
32}
33
34namespace N {
35 void test_multiadd2(X x) {
36 (void)(x + x);
37 }
38}
39
40
41void test_func_adl_only(N::X x) {
42 // FIXME: here, despite the fact that the name lookup for 'g' fails,
43 // this is well-formed code. The fix will go into Sema::ActOnCallExpr.
44 // g(x);
45}