Make CheckError immutable
This marks log_message_ const but more importantly it removes
CheckError's scary defaulted move constructors that if ever used
(not RVO'd) would be UB (double delete) as two ~CheckError would
eventually delete the same log_message_.
Bug: None
Change-Id: Ic6717c3dc466666c9b7adef897d8ff4f91b99fda
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3721089
Commit-Queue: Peter Boström <[email protected]>
Reviewed-by: danakj <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1017363}
diff --git a/base/check.h b/base/check.h
index 6b4de3a..7561cd3 100644
--- a/base/check.h
+++ b/base/check.h
@@ -87,15 +87,13 @@
NOMERGE ~CheckError();
- CheckError(const CheckError& other) = delete;
- CheckError& operator=(const CheckError& other) = delete;
- CheckError(CheckError&& other) = default;
- CheckError& operator=(CheckError&& other) = default;
+ CheckError(const CheckError&) = delete;
+ CheckError& operator=(const CheckError&) = delete;
private:
explicit CheckError(LogMessage* log_message);
- LogMessage* log_message_;
+ LogMessage* const log_message_;
};
#if defined(OFFICIAL_BUILD) && defined(NDEBUG)