Skip to content

Commit

Permalink
Merge pull request Tencent#1989 from adamcalhoon/really-fix-placement…
Browse files Browse the repository at this point in the history
…-new-alignment

Fix the alignment of placement new buffer for GenericValue.
  • Loading branch information
miloyip authored Mar 8, 2022
2 parents e4bde97 + 1dff2ab commit 0d78b1c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/rapidjson/document.h
Original file line number Diff line number Diff line change
Expand Up @@ -1235,8 +1235,8 @@ class GenericValue {
// 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>
Expand Down

0 comments on commit 0d78b1c

Please sign in to comment.