Commit 64debbe9 authored by Jose Dapena Paz's avatar Jose Dapena Paz Committed by Commit Bot

GCC: fix ambiguous auto assignment from initializer list

Fix build error in GCC due to an ambiguous auto resolution. An initializer list
is not compatible with an std::vector in a ? : sequence, so it will fail to
resolve the subsequent auto statement:
 ../../components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc -o obj/components/subresource_filter/content/browser/browser/subresource_filter_safe_browsing_activation_throttle.o
../../components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc: In member function ‘void subresource_filter::SubresourceFilterSafeBrowsingActivationThrottle::NotifyResult()’:
../../components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc:141:26: error: operands to ?: have different types ‘std::vector<subresource_filter::SubresourceFilterSafeBrowsingClient::CheckResult>’ and ‘const std::initializer_list<const subresource_filter::SubresourceFilterSafeBrowsingClient::CheckResult>’
       consider_redirects ? check_results_ : last_result_array;
       ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.cc:145:37: error: unable to deduce ‘auto&&’ from ‘check_results_to_consider’
   for (const auto& current_result : check_results_to_consider) {
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~

The solution is explicitely setting the type instead of using auto, so the resolution
is not ambiguous.

Bug: 819294
Change-Id: Ieae11f751569ffe15a5db49833153478eed4cbcb
Reviewed-on: https://chromium-review.googlesource.com/1087958
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564853}
parent c521c66c
......@@ -134,7 +134,8 @@ void SubresourceFilterSafeBrowsingActivationThrottle::NotifyResult() {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"),
"SubresourceFilterSafeBrowsingActivationThrottle::NotifyResult");
DCHECK(!check_results_.empty());
const auto last_result_array = {check_results_.back()};
const std::vector<SubresourceFilterSafeBrowsingClient::CheckResult>
last_result_array = {check_results_.back()};
const bool consider_redirects = base::FeatureList::IsEnabled(
kSafeBrowsingSubresourceFilterConsiderRedirects);
const auto& check_results_to_consider =
......
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