Skip to content

Commit

Permalink
QV4::Heap::SharedArrayBuffer: avoid std::aligned_storage (deprecated …
Browse files Browse the repository at this point in the history
…in C++23)

... by rolling our own.

Qt 5.15 uses a pointer (additional indirection), not aligned_storage,
so isn't affected.

References:
- cplusplus/papers#197
- https://wg21.link/p1413

Pick-to: 6.4 6.2
Task-number: QTBUG-99122
Change-Id: Ia116dc11336901a19fc227fb68ac266c1bfbbcb1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
  • Loading branch information
marcmutz committed Oct 17, 2022
1 parent 1aa0b1c commit 6e9a9ed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/qml/jsruntime/qv4arraybuffer_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ struct Q_QML_PRIVATE_EXPORT SharedArrayBuffer : Object {
return *reinterpret_cast<QArrayDataPointer<char> *>(&arrayDataPointerStorage);
}

std::aligned_storage_t<sizeof(QArrayDataPointer<char>), alignof(QArrayDataPointer<char>)>
template <typename T>
struct storage_t { alignas(T) unsigned char data[sizeof(T)]; };

storage_t<QArrayDataPointer<char>>
arrayDataPointerStorage;
bool isShared;
};
Expand Down

0 comments on commit 6e9a9ed

Please sign in to comment.