diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-07-14 02:28:44 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-07-14 02:28:44 +0000 |
commit | 19172c4f70face3b717d5f5ba7104aa9e72b30af (patch) | |
tree | 766bce5fcf44d5eb94f0a72f720b1bafa4bd4fe3 /clang/test | |
parent | 67d8b2e2b0174783b3d6ba4737978c190a4c0414 (diff) | |
download | bcm5719-llvm-19172c4f70face3b717d5f5ba7104aa9e72b30af.tar.gz bcm5719-llvm-19172c4f70face3b717d5f5ba7104aa9e72b30af.zip |
Superficial fix for PR20218: binding a function lvalue to a const reference to
a function pointer is neither better nor worse than binding a function lvalue
to a function rvalue reference. Don't get confused and think that both bindings
are binding to a function lvalue (which would make the lvalue form win); the
const reference is binding to an rvalue.
The "real" bug in PR20218 is still present: we're getting the wrong answer from
template argument deduction, and that's what leads us to this weird overload
set.
llvm-svn: 212916
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaCXX/overload-call.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/overload-call.cpp b/clang/test/SemaCXX/overload-call.cpp index da28eefe7a5..01f70b6b23d 100644 --- a/clang/test/SemaCXX/overload-call.cpp +++ b/clang/test/SemaCXX/overload-call.cpp @@ -590,3 +590,25 @@ void test5() { } callable; callable(); // expected-error{{no matching function for call}} } + +namespace PR20218 { + void f(void (*const &)()); // expected-note{{candidate}} + void f(void (&&)()) = delete; // expected-note{{candidate}} expected-warning 2{{extension}} + void g(void (&&)()) = delete; // expected-note{{candidate}} expected-warning 2{{extension}} + void g(void (*const &)()); // expected-note{{candidate}} + + void x(); + typedef void (&fr)(); + struct Y { operator fr(); } y; + + void h() { + f(x); // expected-error {{ambiguous}} + g(x); // expected-error {{ambiguous}} + + // OK! These ones try to copy-initialize a temporary of the reference's + // underlying type, which only works for the pointer case and not for the + // reference case. + f(y); + g(y); + } +} |