diff options
author | George Burgess IV <george.burgess.iv@gmail.com> | 2015-10-16 01:17:38 +0000 |
---|---|---|
committer | George Burgess IV <george.burgess.iv@gmail.com> | 2015-10-16 01:17:38 +0000 |
commit | 2a6150d93290b8b1e73a577226bd9ee4d298a703 (patch) | |
tree | 4892ee0509946c602ce887977c5528a7a987157b /clang/test/SemaCXX/enable_if.cpp | |
parent | 47d118e9f275f3d6d811ad77cac3bdff8d8c2d57 (diff) | |
download | bcm5719-llvm-2a6150d93290b8b1e73a577226bd9ee4d298a703.tar.gz bcm5719-llvm-2a6150d93290b8b1e73a577226bd9ee4d298a703.zip |
[Sema] Fix address-of + enable_if overloading logic
Previously, our logic when taking the address of an overloaded function
would not consider enable_if attributes, so long as all of the enable_if
conditions on a given candidate were true. So, two functions with
identical signatures (one with enable_if attributes, the other without),
would be considered equally good overloads. If we were calling the
function instead of taking its address, then the function with enable_if
attributes would be preferred.
This patch makes us prefer the candidate with enable_if regardless of if
we're calling or taking the address of an overloaded function.
Differential Revision: http://reviews.llvm.org/D13795
llvm-svn: 250486
Diffstat (limited to 'clang/test/SemaCXX/enable_if.cpp')
-rw-r--r-- | clang/test/SemaCXX/enable_if.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/enable_if.cpp b/clang/test/SemaCXX/enable_if.cpp index eb3b265776f..b04d9b4c9df 100644 --- a/clang/test/SemaCXX/enable_if.cpp +++ b/clang/test/SemaCXX/enable_if.cpp @@ -189,7 +189,7 @@ namespace FnPtrs { } int ovlConflict(int m) __attribute__((enable_if(true, ""))); - int ovlConflict(int m); + int ovlConflict(int m) __attribute__((enable_if(1, ""))); void test3() { int (*p)(int) = ovlConflict; // expected-error{{address of overloaded function 'ovlConflict' is ambiguous}} expected-note@191{{candidate function}} expected-note@192{{candidate function}} int (*p2)(int) = &ovlConflict; // expected-error{{address of overloaded function 'ovlConflict' is ambiguous}} expected-note@191{{candidate function}} expected-note@192{{candidate function}} @@ -225,7 +225,7 @@ namespace FnPtrs { template <typename T> T templatedConflict(T m) __attribute__((enable_if(true, ""))) { return T(); } template <typename T> - T templatedConflict(T m) { return T(); } + T templatedConflict(T m) __attribute__((enable_if(1, ""))) { return T(); } void test6() { int (*p)(int) = templatedConflict<int>; // expected-error{{address of overloaded function 'templatedConflict' is ambiguous}} expected-note@224{{candidate function made ineligible by enable_if}} expected-note@226{{candidate function}} expected-note@228{{candidate function}} int (*p0)(int) = &templatedConflict<int>; // expected-error{{address of overloaded function 'templatedConflict' is ambiguous}} expected-note@224{{candidate function made ineligible by enable_if}} expected-note@226{{candidate function}} expected-note@228{{candidate function}} |