Fix the alignment of placement new buffer for GenericValue.

When using operator[] on a GenericValue type clang-tidy complains,
appropriately, about the alignment of the buffer used for placement-new
of the "dummy" GenericValue.
This commit is contained in:
Adam Calhoon 2022-02-08 12:00:56 -05:00
parent fd3dc29a5c
commit 5b242b6b2d

View File

@ -1235,8 +1235,8 @@ public:
// return NullValue;
// Use static buffer and placement-new to prevent destruction
static char buffer[sizeof(GenericValue)];
return *new (buffer) GenericValue();
static GenericValid buffer;
return *new (reinterpret_cast<char *>(&buffer)) GenericValue();
}
}
template <typename SourceAllocator>