blob: 2184116dd2d3c2299e0f6b5ef9bf3915096effb6 [file] [log] [blame]
Douglas Gregor904eed32008-11-10 20:40:00 +00001// RUN: clang -fsyntax-only -verify %s
2int f(double);
3int f(int);
4
5int (*pfd)(double) = f; // selects f(double)
6int (*pfd2)(double) = &f; // selects f(double)
7int (*pfd3)(double) = ((&((f)))); // selects f(double)
8int (*pfi)(int) = &f; // selects f(int)
9// FIXME: This error message is not very good. We need to keep better
10// track of what went wrong when the implicit conversion failed to
11// give a better error message here.
12int (*pfe)(...) = &f; // expected-error{{incompatible type initializing '<overloaded function type>', expected 'int (*)(...)'}}
13int (&rfi)(int) = f; // selects f(int)
14int (&rfd)(double) = f; // selects f(double)
15
16void g(int (*fp)(int)); // expected-note{{note: candidate function}}
17void g(int (*fp)(float));
18void g(int (*fp)(double)); // expected-note{{note: candidate function}}
19
20int g1(int);
21int g1(char);
22
23int g2(int);
24int g2(double);
25
26void g_test() {
27 g(g1);
28 g(g2); // expected-error{{call to 'g' is ambiguous; candidates are:}}
29}