QHash: port away from std::aligned_storage

It's deprecated in C++23. Just use an explicitly-aligned char array
directly, wrapped in a struct to avoid decays to char*.

Task-number: QTBUG-99122
Pick-to: 6.3 6.2
Change-Id: I802761c1af62efa6ffc006b07837a7deed1ea4cc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2022-05-07 12:28:35 +02:00
parent 38002df206
commit d8e03bb02d

View File

@ -280,7 +280,7 @@ struct Span {
// When a node gets inserted, the first free entry is being picked, removed
// from the singly linked list and the Node gets constructed in place.
struct Entry {
typename std::aligned_storage<sizeof(Node), alignof(Node)>::type storage;
struct { alignas(Node) unsigned char data[sizeof(Node)]; } storage;
unsigned char &nextFree() { return *reinterpret_cast<unsigned char *>(&storage); }
Node &node() { return *reinterpret_cast<Node *>(&storage); }