From 064fdb2fe844a4c70fc9b16426433878d78c8298 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 14 Apr 2010 23:11:21 +0000 Subject: 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 . llvm-svn: 101312 --- clang/test/SemaCXX/addr-of-overloaded-function.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'clang/test/SemaCXX/addr-of-overloaded-function.cpp') diff --git a/clang/test/SemaCXX/addr-of-overloaded-function.cpp b/clang/test/SemaCXX/addr-of-overloaded-function.cpp index 3b06119393d..391fc309598 100644 --- a/clang/test/SemaCXX/addr-of-overloaded-function.cpp +++ b/clang/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 ()'}} + } +}; -- cgit v1.2.3