From bfeb6d4361a18a96a7531e457f310f044e511f36 Mon Sep 17 00:00:00 2001 From: Soeren Grunewald Date: Fri, 17 Jul 2026 13:45:05 +0200 Subject: [PATCH] Suppress another GCC 16 warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Why] The compiler complains about this: > In static member function ‘static std::enable_if_t<((bool)std::is_nothrow_move_constructible::value)> gul17::SmallVector::uninitialized_move(T*, T*, T*) [with T = unsigned int; ElementT = unsigned int; long unsigned int in_capacity = 8]’, > inlined from ‘static std::enable_if_t<((bool)std::is_nothrow_move_constructible::value)> gul17::SmallVector::uninitialized_move_or_copy(T*, T*, T*) [with T = unsigned int; ElementT = unsigned int; long unsigned int in_capacity = 8]’ at gul17/SmallVector.h:1676:27, > inlined from ‘void gul17::SmallVector::move_or_copy_all_elements_from(gul17::SmallVector&&) [with ElementT = unsigned int; long unsigned int in_capacity = 8]’ at gul17/SmallVector.h:1560:39, > inlined from ‘void gul17::SmallVector::move_or_copy_all_elements_from(gul17::SmallVector&&) [with ElementT = unsigned int; long unsigned int in_capacity = 8]’ at gul17/SmallVector.h:1546:10, > ---8<--- > inlined from ‘void CATCH2_INTERNAL_TEST_188()’ at clientlib/tests/test_serialization.cc:3305:1: > gul17/SmallVector.h:1664:13: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ forming offset [440, 751] is out of the bounds [0, 440] of object ‘’ with type ‘const doocs::Field [5]’ [-Warray-bounds=] > 1664 | ::new (static_cast(dest)) ValueType(std::move(*src)); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [How] Disable the warning for now. But if we do so, we trigger a second warning, which we need to disable as well. Signed-off-by: Soeren Grunewald --- include/gul17/SmallVector.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/gul17/SmallVector.h b/include/gul17/SmallVector.h index 7c4f6c1..272ba9b 100644 --- a/include/gul17/SmallVector.h +++ b/include/gul17/SmallVector.h @@ -1661,7 +1661,15 @@ class SmallVector while (src != src_end) { +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif ::new (static_cast(dest)) ValueType(std::move(*src)); +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif ++src; ++dest; }