Skip to content

Commit

Permalink
Merge pull request #1988 from Tencent/revert-1987-fix-placement-new-a…
Browse files Browse the repository at this point in the history
…lignment

Revert "Fix the alignment of placement new buffer for GenericValue."
  • Loading branch information
miloyip authored Feb 9, 2022
2 parents bf8ca5d + 88bbd87 commit e4bde97
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 GenericValid buffer;
return *new (reinterpret_cast<char *>(&buffer)) GenericValue();
static char buffer[sizeof(GenericValue)];
return *new (buffer) GenericValue();
}
}
template <typename SourceAllocator>
Expand Down

0 comments on commit e4bde97

Please sign in to comment.