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.
This commit is contained in:
Peter Kasting 2022-05-06 16:03:36 -07:00 committed by Milo Yip
parent 2b2c804500
commit 0390b1ad57

View File

@ -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>