summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar GOGOYAO <shunyuyao@126.com>2022-10-04 08:45:16 +0800
committerGravatar GitHub <noreply@github.com>2022-10-04 08:45:16 +0800
commit75173d858538930b65a6754560113527822ed727 (patch)
treee25b3d32ec39c1008c311a12c2d926050a5a3348
parent535f22b4a08a11166c91fabc22fe130933c745a7 (diff)
Initialize `Allocation` to eliminate compile error
Class `Allocation` is not initialized and I will get a compile error like this. ``` error: ‘worklist.absl::lts_20220623::InlinedVector<absl::lts_20220623::cord_internal::CordRep*, 2, std::allocator<absl::lts_20220623::cord_internal::CordRep*> >::storage_.absl::lts_20220623::inlined_vector_internal::Storage<absl::lts_20220623::cord_internal::CordRep*, 2, std::allocator<absl::lts_20220623::cord_internal::CordRep*> >::data_.absl::lts_20220623::inlined_vector_internal::Storage<absl::lts_20220623::cord_internal::CordRep*, 2, std::allocator<absl::lts_20220623::cord_internal::CordRep*> >::Data::allocated.absl::lts_20220623::inlined_vector_internal::Storage<absl::lts_20220623::cord_internal::CordRep*, 2, std::allocator<absl::lts_20220623::cord_internal::CordRep*> >::Allocated::allocated_capacity’ may be used uninitialized [-Werror=maybe-uninitialized] ```
-rw-r--r--absl/container/internal/inlined_vector.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/absl/container/internal/inlined_vector.h b/absl/container/internal/inlined_vector.h
index a56b7573..7ae3da84 100644
--- a/absl/container/internal/inlined_vector.h
+++ b/absl/container/internal/inlined_vector.h
@@ -120,8 +120,8 @@ struct DestroyAdapter<A, /* IsTriviallyDestructible */ true> {
template <typename A>
struct Allocation {
- Pointer<A> data;
- SizeType<A> capacity;
+ Pointer<A> data = nullptr;
+ SizeType<A> capacity = 0;
};
template <typename A,