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:
authorPeter Kasting <pkasting@chromium.org>2022-05-07 02:03:36 +0300
committerMilo Yip <miloyip@gmail.com>2022-05-19 06:55:17 +0300
commit0390b1ad5753f94284bba8c7fa8acb97640b9212 (patch)
tree2fe332becb1ef860dd77bc3a0a3b234b60656163
parent2b2c80450031028439ba2a17a09ef5aa10f2159b (diff)
Avoid exit-time destructors.
operator[]() was recently changed to use the existing code in order to correctly align the returned pointer; however this broke -Wexit-time-destructors. Change to a method that is still correctly aligned but does not generate a destructor.
-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 74089cb9..ea6d8069 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 GenericValue buffer;
- return *new (reinterpret_cast<char *>(&buffer)) GenericValue();
+ alignas(GenericValue) static char buffer[sizeof(GenericValue)];
+ return *new (buffer) GenericValue();
}
}
template <typename SourceAllocator>