blob: 9c0117f9b14d985cb6ae0ae018f10cdaf6c9fc5d [file] [log] [blame]
Douglas Gregor88a35142008-12-22 05:46:06 +00001// RUN: clang -fsyntax-only -verify %s
2
3struct X {
4 int& f(int) const; // expected-note{{candidate function}}
5 float& f(int); // expected-note{{candidate function}}
6
7 void test_f(int x) const {
8 int& i = f(x);
9 }
10
11 void test_f2(int x) {
12 float& f2 = f(x);
13 }
14
15 int& g(int) const; // expected-note{{candidate function}}
16 float& g(int); // expected-note{{candidate function}}
17 static double& g(double); // expected-note{{candidate function}}
18
19 void h(int);
20};
21
22void test(X x, const X xc, X* xp, const X* xcp, volatile X xv, volatile X* xvp) {
23 int& i1 = xc.f(0);
24 int& i2 = xcp->f(0);
25 float& f1 = x.f(0);
26 float& f2 = xp->f(0);
27 xv.f(0); // expected-error{{no matching member function for call to 'f'; candidates are:}}
28 xvp->f(0); // expected-error{{no matching member function for call to 'f'; candidates are:}}
29
30 int& i3 = xc.g(0);
31 int& i4 = xcp->g(0);
32 float& f3 = x.g(0);
33 float& f4 = xp->g(0);
34 double& d1 = xp->g(0.0);
35 double& d2 = X::g(0.0);
36 X::g(0); // expected-error{{call to 'g' is ambiguous; candidates are:}}
37
38 X::h(0); // expected-error{{call to non-static member function without an object argument}}
39}