Skip to content

Commit

Permalink
Attempt at fix for GCC warning
Browse files Browse the repository at this point in the history
In function ‘void* memcpy(void*, const void*, size_t)’,
    inlined from ‘T* oel::dynarray<T, Alloc>::emplace(const_iterator, Args&& ...) & [with Args = {dynarrayTest_overAligned_Test::TestBody()::Type}; T = dynarrayTest_overAligned_Test::TestBody()::Type; Alloc = oel::allocator<>]’ at dynarray.h:614:13,
    inlined from ‘T* oel::dynarray<T, Alloc>::insert(const_iterator, T&&) & [with T = dynarrayTest_overAligned_Test::TestBody()::Type; Alloc = oel::allocator<>]’ at OE-Lib/dynarray.h:164:72,
    inlined from ‘virtual void dynarrayTest_overAligned_Test::TestBody()’ at OE-Lib/unit_test/dynarray_mutate_gtest.cpp:893:16:
    warning: ‘tmp’ may be used uninitialized [-Wmaybe-uninitialized]
  • Loading branch information
OleErikPeistorpet committed May 28, 2024
1 parent 83df89d commit aff3362
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dynarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ typename dynarray<T, Alloc>::iterator
OEL_DYNARR_INSERT_STEP1

// Temporary in case constructor throws or args refer to an element of this dynarray
storage_for<T> tmp;
alignas(T) unsigned char tmp[sizeof(T)];
_alloTrait::construct(_m, reinterpret_cast<T *>(&tmp), static_cast<Args &&>(args)...);
if (_m.end < _m.reservEnd)
{ // Relocate [pos, end) to [pos + 1, end + 1)
Expand Down

0 comments on commit aff3362

Please sign in to comment.