Commit d7b8f41f authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[torque] fix overload resolution for implicit parameters

This bug surfaced in builds with some versions of libstdc++
(use_custom_libcxx=false), because of an additional debug check in
std::min_element.

Change-Id: I799c0a282101373ecf743eed61f911886ca23dc8
Reviewed-on: https://chromium-review.googlesource.com/c/1282989Reviewed-by: 's avatarDaniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56682}
parent f602712f
......@@ -1406,14 +1406,16 @@ Callable* ImplementationVisitor::LookupCall(
}
auto is_better_candidate = [&](Macro* a, Macro* b) {
return ParameterDifference(a->signature().parameter_types.types,
return ParameterDifference(a->signature().GetExplicitTypes(),
parameter_types)
.StrictlyBetterThan(ParameterDifference(
b->signature().parameter_types.types, parameter_types));
b->signature().GetExplicitTypes(), parameter_types));
};
Macro* best = *std::min_element(candidates.begin(), candidates.end(),
is_better_candidate);
// This check is contained in libstdc++'s std::min_element.
DCHECK(!is_better_candidate(best, best));
for (Macro* candidate : candidates) {
if (candidate != best && !is_better_candidate(best, candidate)) {
FailMacroLookup("ambiguous macro", name, arguments, candidates);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment