summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2020-02-04 12:20:34 -0800
committerRichard Smith <richard@metafoo.co.uk>2020-02-04 12:22:49 -0800
commit300cbdc59da05756f7a0334338076124536df03d (patch)
tree9bbbdcbdf09b163d35fafcb482f4aeec4cd3b96f /clang/lib/Sema/SemaOverload.cpp
parent2d9954dd8244c7a9d6a1e160fcbb22fe2b9b514f (diff)
downloadbcm5719-llvm-300cbdc59da05756f7a0334338076124536df03d.tar.gz
bcm5719-llvm-300cbdc59da05756f7a0334338076124536df03d.zip
PR44761: Fix fallback to later tiebreakers if two non-template functions
are equally constrained. (cherry picked from commit cfacf9ae20b8c97a428f118a2720bc109ba6a143)
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r--clang/lib/Sema/SemaOverload.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index c5ada02ba89..9a9843827b3 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -9579,17 +9579,15 @@ bool clang::isBetterOverloadCandidate(
if (RC1 && RC2) {
bool AtLeastAsConstrained1, AtLeastAsConstrained2;
if (S.IsAtLeastAsConstrained(Cand1.Function, {RC1}, Cand2.Function,
- {RC2}, AtLeastAsConstrained1))
- return false;
- if (!AtLeastAsConstrained1)
- return false;
- if (S.IsAtLeastAsConstrained(Cand2.Function, {RC2}, Cand1.Function,
+ {RC2}, AtLeastAsConstrained1) ||
+ S.IsAtLeastAsConstrained(Cand2.Function, {RC2}, Cand1.Function,
{RC1}, AtLeastAsConstrained2))
return false;
- if (!AtLeastAsConstrained2)
- return true;
- } else if (RC1 || RC2)
+ if (AtLeastAsConstrained1 != AtLeastAsConstrained2)
+ return AtLeastAsConstrained1;
+ } else if (RC1 || RC2) {
return RC1 != nullptr;
+ }
}
}
OpenPOWER on IntegriCloud