You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chromium/chromium-86-ConsumeDuration...

33 lines
1.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

From f64e2d2daa64749995253f8ad00679ce74abdc1b Mon Sep 17 00:00:00 2001
From: Jose Dapena Paz <jdapena@igalia.com>
Date: Wed, 19 Aug 2020 11:02:00 +0200
Subject: [PATCH] GCC: ConsumeDurationNumber cannot be a constexpr
Declaring base::ConsumeDurationNumber as constexpr is not valid, as it
uses the BasicStringPiece::begin method, that is not constexpr.
build error in GCC:
../../base/time/time.cc: In function constexpr base::Optional<base::{anonymous}::ParsedDecimal> base::{anonymous}::ConsumeDurationNumber(base::StringPiece&):
../../base/time/time.cc:67:63: error: call to non-constexpr function const value_type* base::BasicStringPiece<STRING_TYPE>::begin() const [with STRING_TYPE = std::__cxx11::basic_string<char>; base::BasicStringPiece<STRING_TYPE>::const_iterator = const char*; base::BasicStringPiece<STRING_TYPE>::value_type = char]
67 | StringPiece::const_iterator orig_start = number_string.begin();
| ~~~~~~~~~~~~~~~~~~~^~
Bug: 859294
Change-Id: Id987d003f66052848d7083bb33abc3acfd109b73
---
diff --git a/base/time/time.cc b/base/time/time.cc
index 1b1a830..7c47419 100644
--- a/base/time/time.cc
+++ b/base/time/time.cc
@@ -61,8 +61,7 @@
//
// Adapted from absl:
// https://cs.chromium.org/chromium/src/third_party/abseil-cpp/absl/time/duration.cc?l=807&rcl=2c22e9135f107a4319582ae52e2e3e6b201b6b7c
-constexpr Optional<ParsedDecimal> ConsumeDurationNumber(
- StringPiece& number_string) {
+Optional<ParsedDecimal> ConsumeDurationNumber(StringPiece& number_string) {
ParsedDecimal res;
StringPiece::const_iterator orig_start = number_string.begin();
// Parse contiguous digits.