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:
authorAdam Calhoon <adam.calhoon@ready-robotics.com>2022-02-09 06:29:15 +0300
committerAdam Calhoon <adam.calhoon@ready-robotics.com>2022-02-09 06:29:15 +0300
commit1dff2abff78ddb0105c7bc0629816ad779f921e2 (patch)
tree9bd52390bd795631352ea356e12469ab77d17526
parentfd3dc29a5c2852df569e1ea81dbde2c412ac5051 (diff)
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.
-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>