From 977d887a4ea9ae82182d6c26b2114a0fb0cade72 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 13 Jun 2023 12:28:44 +0300 Subject: [PATCH] Suppress a bogus warning --- include/fmt/format.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 3bba5c59c3f0..30ab89973127 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -83,7 +83,7 @@ # if FMT_CPLUSPLUS >= 202002L # if FMT_HAS_CPP_ATTRIBUTE(no_unique_address) # define FMT_NO_UNIQUE_ADDRESS [[no_unique_address]] -# elif FMT_MSC_VERSION >= 1929 // VS2019 v16.10 and later +# elif FMT_MSC_VERSION >= 1929 // VS2019 v16.10 and later # define FMT_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] # endif # else @@ -953,6 +953,8 @@ class basic_memory_buffer final : public detail::buffer { T* old_data = this->data(); T* new_data = std::allocator_traits::allocate(alloc_, new_capacity); + // Suppress a bogus -Wstringop-overflow in gcc 13.1 (#3481). + FMT_ASSERT(this->size() <= new_capacity, ""); // The following code doesn't throw, so the raw pointer above doesn't leak. std::uninitialized_copy(old_data, old_data + this->size(), detail::make_checked(new_data, new_capacity));