Skip to content

Commit 1dff2ab

Browse files
committed
Fix the alignment of placement new buffer for GenericValue.
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.
1 parent fd3dc29 commit 1dff2ab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/rapidjson/document.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,8 +1235,8 @@ class GenericValue {
12351235
// return NullValue;
12361236

12371237
// Use static buffer and placement-new to prevent destruction
1238-
static char buffer[sizeof(GenericValue)];
1239-
return *new (buffer) GenericValue();
1238+
static GenericValue buffer;
1239+
return *new (reinterpret_cast<char *>(&buffer)) GenericValue();
12401240
}
12411241
}
12421242
template <typename SourceAllocator>

0 commit comments

Comments
 (0)