Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Douglas Gregor | 904eed3 | 2008-11-10 20:40:00 +0000 | [diff] [blame] | 2 | int f(double); |
| 3 | int f(int); |
| 4 | |
| 5 | int (*pfd)(double) = f; // selects f(double) |
| 6 | int (*pfd2)(double) = &f; // selects f(double) |
| 7 | int (*pfd3)(double) = ((&((f)))); // selects f(double) |
| 8 | int (*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. |
| 12 | int (*pfe)(...) = &f; // expected-error{{incompatible type initializing '<overloaded function type>', expected 'int (*)(...)'}} |
| 13 | int (&rfi)(int) = f; // selects f(int) |
| 14 | int (&rfd)(double) = f; // selects f(double) |
| 15 | |
| 16 | void g(int (*fp)(int)); // expected-note{{note: candidate function}} |
| 17 | void g(int (*fp)(float)); |
| 18 | void g(int (*fp)(double)); // expected-note{{note: candidate function}} |
| 19 | |
| 20 | int g1(int); |
| 21 | int g1(char); |
| 22 | |
| 23 | int g2(int); |
| 24 | int g2(double); |
| 25 | |
| 26 | void g_test() { |
| 27 | g(g1); |
| 28 | g(g2); // expected-error{{call to 'g' is ambiguous; candidates are:}} |
| 29 | } |