diff options
author | Milo Yip <miloyip@gmail.com> | 2022-03-08 12:09:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-08 12:09:47 +0300 |
commit | 0d78b1ce9316a9c84d58592fd717eccf41969d4a (patch) | |
tree | 9bd52390bd795631352ea356e12469ab77d17526 | |
parent | e4bde977440d4a00f820b6586899e48a972d2493 (diff) | |
parent | 1dff2abff78ddb0105c7bc0629816ad779f921e2 (diff) |
Merge pull request #1989 from adamcalhoon/really-fix-placement-new-alignment
Fix the alignment of placement new buffer for GenericValue.
-rw-r--r-- | include/rapidjson/document.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index e2cc6000..1cdc29c0 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -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> |