--- a/src/google/protobuf/repeated_field.h 2022-12-13 02:03:12.000000000 +0200 +++ b/src/google/protobuf/repeated_field.h 2023-02-13 16:30:24.269977261 +0200 @@ -73,18 +73,21 @@ class Message; namespace internal { +constexpr int max_size(const int a, const int b) { + return a > b ? a : b; +} template constexpr int RepeatedFieldLowerClampLimit() { // The header is padded to be at least `sizeof(T)` when it would be smaller // otherwise. - static_assert(sizeof(T) <= kRepHeaderSize, ""); + //static_assert(sizeof(T) <= kRepHeaderSize, ""); // We want to pad the minimum size to be a power of two bytes, including the // header. // The first allocation is kRepHeaderSize bytes worth of elements for a total // of 2*kRepHeaderSize bytes. // For an 8-byte header, we allocate 8 bool, 2 ints, or 1 int64. - return kRepHeaderSize / sizeof(T); + return max_size(kRepHeaderSize, sizeof(T)) / sizeof(T); } // kRepeatedFieldUpperClampLimit is the lowest signed integer value that