Skip to content

Commit bf8ca5d

Browse files
authored
Merge pull request Tencent#1987 from adamcalhoon/fix-placement-new-alignment
Fix the alignment of placement new buffer for GenericValue.
2 parents fd3dc29 + 5b242b6 commit bf8ca5d

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 GenericValid buffer;
1239+
return *new (reinterpret_cast<char *>(&buffer)) GenericValue();
12401240
}
12411241
}
12421242
template <typename SourceAllocator>

0 commit comments

Comments
 (0)