[go: nahoru, domu]

Skip to content

Commit

Permalink
Fix the alignment of placement new buffer for GenericValue.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
adamcalhoon committed Feb 9, 2022
1 parent fd3dc29 commit 1dff2ab
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 1dff2ab

Please sign in to comment.