Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix warning violations of array-bounds in small_vector
Summary: Fixes or works around the following warning violations: ``` In file included from folly/small_vector.h:17, from folly/container/test/small_vector_test.cpp:17: In lambda function, inlined from ‘void folly::detail::populateMemForward(T*, std::size_t, const Function&) [with T = int; Function = folly::small_vector<int>::constructImpl(size_type, const value_type&, std::true_type)::<lambda(void*)>]’ at folly/container/small_vector.h:229:9, inlined from ‘void folly::small_vector<T, M, P>::doConstruct(size_type, InitFunc&&) [with InitFunc = folly::small_vector<int>::constructImpl(size_type, const value_type&, std::true_type)::<lambda(void*)>; Value = int; long unsigned int RequestedMaxInline = 1; Policy = void]’ at folly/container/small_vector.h:1164:33, inlined from ‘void folly::small_vector<T, M, P>::constructImpl(size_type, const value_type&, std::true_type) [with Value = int; long unsigned int RequestedMaxInline = 1; Policy = void]’ at folly/container/small_vector.h:1172:16, inlined from ‘folly::small_vector<T, M, P>::small_vector(Arg, Arg) [with Arg = int; Value = int; long unsigned int RequestedMaxInline = 1; Policy = void]’ at folly/container/small_vector.h:575:18, inlined from ‘virtual void smallVector_InsertTrivial_Test::TestBody()’ at folly/container/test/small_vector_test.cpp:406:40: folly/container/small_vector.h:1172:35: warning: array subscript 4 is outside array bounds of ‘folly::small_vector<int> [1]’ [-Warray-bounds=] 1172 | doConstruct(n, [&](void* p) { new (p) value_type(val); }); | ^~~~~~~~~~~~~~~~~~~~~~~ ``` Reviewed By: ilvokhin Differential Revision: D68424534 fbshipit-source-id: 9ba06273d38b6008fa4e759fdcf4e40859567c4c
- Loading branch information