Skip to content

Commit

Permalink
GCC: explicitely move return value of SCTHashdanceMetadata::ToValue
Browse files Browse the repository at this point in the history
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
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3488747
Reviewed-by: Chris Thompson <[email protected]>
Commit-Queue: José Dapena Paz <[email protected]>
Cr-Commit-Position: refs/heads/main@{#976299}
  • Loading branch information
jdapena authored and Chromium LUCI CQ committed Mar 1, 2022
1 parent 95d009a commit 2c9bf9f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion services/network/sct_auditing/sct_auditing_reporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ base::Value SCTAuditingReporter::SCTHashdanceMetadata::ToValue() const {
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
Expand Down

0 comments on commit 2c9bf9f

Please sign in to comment.