summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/addr-of-overloaded-function.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-14 23:11:21 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-14 23:11:21 +0000
commit064fdb2fe844a4c70fc9b16426433878d78c8298 (patch)
tree25296d5b679b53117d73b80ec98918b1d5b2f6ea /clang/test/SemaCXX/addr-of-overloaded-function.cpp
parent1deb972b55c20d14ecdcce3515b4596311fae5b2 (diff)
downloadbcm5719-llvm-064fdb2fe844a4c70fc9b16426433878d78c8298.tar.gz
bcm5719-llvm-064fdb2fe844a4c70fc9b16426433878d78c8298.zip
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>. llvm-svn: 101312
Diffstat (limited to 'clang/test/SemaCXX/addr-of-overloaded-function.cpp')
-rw-r--r--clang/test/SemaCXX/addr-of-overloaded-function.cpp16
1 files changed, 16 insertions, 0 deletions
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 ()'}}
+ }
+};
OpenPOWER on IntegriCloud