diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-14 23:11:21 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-14 23:11:21 +0000 |
commit | 1a8cf73a825ef35917eede448817237b5fd47b05 (patch) | |
tree | d4bc9b1bdc3a7bab3e0f95fd2570dd72a8283aa4 /test/SemaCXX/addr-of-overloaded-function.cpp | |
parent | 4cd8494d9a2f99cbf38147bca80be18cdff83734 (diff) |
Always diagnose and complain about problems in
ResolveAddressOfOverloadedFunction when asked to complain. Previously,
we had some weird handshake where ResolveAddressOfOverloadedFunction
expected its caller to handle some of the diagnostics but not others,
and yet there was no way for the caller to know which case we were
in. Eliminate this madness, fixing <rdar://problem/7765884>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101312 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/addr-of-overloaded-function.cpp')
-rw-r--r-- | test/SemaCXX/addr-of-overloaded-function.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/SemaCXX/addr-of-overloaded-function.cpp b/test/SemaCXX/addr-of-overloaded-function.cpp index 3b06119393..391fc30959 100644 --- a/test/SemaCXX/addr-of-overloaded-function.cpp +++ b/test/SemaCXX/addr-of-overloaded-function.cpp @@ -54,3 +54,19 @@ struct B void d(void *); static void d(A *); }; + +struct C { + C &getC() { + return makeAC; // expected-error{{address of overloaded function 'makeAC' cannot be converted to type 'C'}} + } + + C &makeAC(); + const C &makeAC() const; + + static void f(); // expected-note{{candidate function}} + static void f(int); // expected-note{{candidate function}} + + void g() { + int (&fp)() = f; // expected-error{{address of overloaded function 'f' does not match required type 'int ()'}} + } +}; |