From 364dc0067d1c20c7a2d21277a7ec0c4419d9bc11 Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Wed, 23 Feb 2022 12:18:57 +0100 Subject: [PATCH] GCC: explicitely move return value of SCTHashdanceMetadata::ToValue GCC rejects to do Return Value Optimization in SCTHashdanceMetadata::ToValue, because the copy constructor is deleted, and in that scenario RVO is rejected in GCC: ../../services/network/sct_auditing/sct_auditing_reporter.cc: In member function ‘base::Value network::SCTAuditingReporter::SCTHashdanceMetadata::ToValue() const’: ../../services/network/sct_auditing/sct_auditing_reporter.cc:191:10: error: use of deleted function ‘base::Value::Value(const base::Value&)’ 191 | return value; | ^~~~~ In file included from ../../services/network/sct_auditing/sct_auditing_reporter.h:14, from ../../services/network/sct_auditing/sct_auditing_reporter.cc:5: ../../base/values.h:254:3: note: declared here 254 | Value(const Value&) = delete; | ^~~~~ Bug: 819294 Change-Id: I111e51dd10eee7b909d4ac3c0911aac18a589166 --- diff --git a/services/network/sct_auditing/sct_auditing_reporter.cc b/services/network/sct_auditing/sct_auditing_reporter.cc index a057e8e..365527b 100644 --- a/services/network/sct_auditing/sct_auditing_reporter.cc +++ b/services/network/sct_auditing/sct_auditing_reporter.cc @@ -188,7 +188,7 @@ kLogIdKey, base::Base64Encode(base::as_bytes(base::make_span(log_id)))); value.SetKey(kLogMMDKey, base::TimeDeltaToValue(log_mmd)); value.SetKey(kCertificateExpiry, base::TimeToValue(certificate_expiry)); - return value; + return std::move(value); } // static