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:
parent
2b2c804500
commit
0390b1ad57
@ -1235,8 +1235,8 @@ public:
|
|||||||
// return NullValue;
|
// return NullValue;
|
||||||
|
|
||||||
// Use static buffer and placement-new to prevent destruction
|
// Use static buffer and placement-new to prevent destruction
|
||||||
static GenericValue buffer;
|
alignas(GenericValue) static char buffer[sizeof(GenericValue)];
|
||||||
return *new (reinterpret_cast<char *>(&buffer)) GenericValue();
|
return *new (buffer) GenericValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template <typename SourceAllocator>
|
template <typename SourceAllocator>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user