From 65be571f6ac2f7942b4df9e50b24da517f829eec Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Mon, 15 Oct 2018 20:26:10 +0000 Subject: [PATCH] google_util: Explicitly use std::initializer_list with base::NoDestructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to ac53c5c53 ("Remove CR_DEFINE_STATIC_LOCAL from /components"). Due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84849, having base::NoDestructor> and passing an initializer list of Us does not work if this is not done explicitly, as GCC incorrectly fails to determine which constructor overload to use: ../../components/google/core/common/google_util.cc: In function ‘bool google_util::{anonymous}::IsCanonicalHostGoogleHostname(base::StringPiece, google_util::SubdomainPermission)’: ../../components/google/core/common/google_util.cc:120:24: error: call of overloaded ‘NoDestructor()’ is ambiguous {GOOGLE_TLD_LIST}); See also: https://chromium-review.googlesource.com/c/chromium/src/+/1170905 Bug: 819294 Change-Id: Ie1490b6646d7998d636c485769caabf56c1cf44c Reviewed-on: https://chromium-review.googlesource.com/c/1275854 Reviewed-by: Peter Kasting Commit-Queue: Raphael Kubo da Costa (CET) Cr-Commit-Position: refs/heads/master@{#599733} --- components/google/core/common/google_util.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/google/core/common/google_util.cc b/components/google/core/common/google_util.cc index a44c84393820..7733848a0443 100644 --- components/google/core/common/google_util.cc +++ components/google/core/common/google_util.cc @@ -117,7 +117,7 @@ bool IsCanonicalHostGoogleHostname(base::StringPiece canonical_host, StripTrailingDot(&tld); static base::NoDestructor> google_tlds( - {GOOGLE_TLD_LIST}); + std::initializer_list({GOOGLE_TLD_LIST})); return base::ContainsKey(*google_tlds, tld.as_string()); } @@ -132,7 +132,8 @@ bool IsGoogleSearchSubdomainUrl(const GURL& url) { StripTrailingDot(&host); static base::NoDestructor> google_subdomains( - {"ipv4.google.com", "ipv6.google.com"}); + std::initializer_list( + {"ipv4.google.com", "ipv6.google.com"})); return base::ContainsKey(*google_subdomains, host.as_string()); } -- 2.19.1