Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/miloyip/rapidjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilo Yip <miloyip@gmail.com>2022-03-08 12:09:47 +0300
committerGitHub <noreply@github.com>2022-03-08 12:09:47 +0300
commit0d78b1ce9316a9c84d58592fd717eccf41969d4a (patch)
tree9bd52390bd795631352ea356e12469ab77d17526
parente4bde977440d4a00f820b6586899e48a972d2493 (diff)
parent1dff2abff78ddb0105c7bc0629816ad779f921e2 (diff)
Merge pull request #1989 from adamcalhoon/really-fix-placement-new-alignment
Fix the alignment of placement new buffer for GenericValue.
-rw-r--r--include/rapidjson/document.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h
index e2cc6000..1cdc29c0 100644
--- a/include/rapidjson/document.h
+++ b/include/rapidjson/document.h
@@ -1235,8 +1235,8 @@ public:
// 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>