From 75173d858538930b65a6754560113527822ed727 Mon Sep 17 00:00:00 2001 From: GOGOYAO Date: Tue, 4 Oct 2022 08:45:16 +0800 Subject: Initialize `Allocation` to eliminate compile error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Class `Allocation` is not initialized and I will get a compile error like this. ``` error: ‘worklist.absl::lts_20220623::InlinedVector >::storage_.absl::lts_20220623::inlined_vector_internal::Storage >::data_.absl::lts_20220623::inlined_vector_internal::Storage >::Data::allocated.absl::lts_20220623::inlined_vector_internal::Storage >::Allocated::allocated_capacity’ may be used uninitialized [-Werror=maybe-uninitialized] ``` --- absl/container/internal/inlined_vector.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'absl/container') 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 { template struct Allocation { - Pointer data; - SizeType capacity; + Pointer data = nullptr; + SizeType capacity = 0; }; template