[qt] Fix QThreadStorage cast (#664)

This commit is contained in:
Tadej Novak
2023-01-08 11:45:15 +01:00
committed by GitHub
parent d92431b404
commit 90f5ef05fb

View File

@@ -16,7 +16,7 @@ using StorageType = QThreadStorage<std::array<void*, 1>>;
ThreadLocalBase::ThreadLocalBase() {
static_assert(sizeof(storage) >= sizeof(StorageType), "storage is too small");
static_assert(alignof(decltype(storage)) % alignof(StorageType) == 0, "storage is incorrectly aligned");
new (&reinterpret_cast<StorageType&>(storage)) QThreadStorage<void*>();
new (&reinterpret_cast<StorageType&>(storage)) QThreadStorage<std::array<void*, 1>>();
}
ThreadLocalBase::~ThreadLocalBase() {