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-02-09 05:47:25 +0300
committerGitHub <noreply@github.com>2022-02-09 05:47:25 +0300
commitbf8ca5da88c57c34217901e588f6a1f163180180 (patch)
treea62e65cd90d7e3c52d17c4965eb2ddd92b3c621c
parentfd3dc29a5c2852df569e1ea81dbde2c412ac5051 (diff)
parent5b242b6b2d63b8d5cb422fbe740cdfce3edca3b5 (diff)
Merge pull request #1987 from adamcalhoon/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..92794744 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 GenericValid buffer;
+ return *new (reinterpret_cast<char *>(&buffer)) GenericValue();
}
}
template <typename SourceAllocator>