Merge pull request #1989 from adamcalhoon/really-fix-placement-new-alignment

Fix the alignment of placement new buffer for GenericValue.
This commit is contained in:
Milo Yip 2022-03-08 17:09:47 +08:00 committed by GitHub
commit 0d78b1ce93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 GenericValue buffer;
return *new (reinterpret_cast<char *>(&buffer)) GenericValue();
}
}
template <typename SourceAllocator>