Skip to content

Commit 0d78b1c

Browse files
authored
Merge pull request Tencent#1989 from adamcalhoon/really-fix-placement-new-alignment
Fix the alignment of placement new buffer for GenericValue.
2 parents e4bde97 + 1dff2ab commit 0d78b1c

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)