diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 018bbcfb1f1..08bfd000fbc 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -125,7 +125,6 @@ jobs: esac - name: Make run: | - ccache -C ccache -z cmake --build build/ -j $(nproc) ccache -s diff --git a/src/common/base/StatusOr.h b/src/common/base/StatusOr.h index 05e1721e927..89e702be361 100644 --- a/src/common/base/StatusOr.h +++ b/src/common/base/StatusOr.h @@ -290,16 +290,19 @@ class StatusOr final { void resetValue() { destructValue(); + new (&variant_) Variant(); state_ = kVoid; } void resetStatus() { destructStatus(); + new (&variant_) Variant(); state_ = kVoid; } void destruct() { if (isVoid()) { + destructStatus(); return; } if (hasValue()) { @@ -311,13 +314,14 @@ class StatusOr final { void reset() { destruct(); + new (&variant_) Variant(); state_ = kVoid; } private: // Variant type to hold a `Status', or a `T', or nothing union Variant { - Variant() {} + Variant() : status_(Status()) {} Variant(const Status &status) : status_(status) {} Variant(Status &&status) : status_(std::move(status)) {} template >>