Remove the alignas() from QVariant::Private
This was causing miscompilations with clang on macOS. As it's not really required, remove the alignment requirement. Change-Id: Iacef1af7f51990daddc73fe74449adc1a823aa33 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
639c2e7f20
commit
a5c71e4366
@ -255,7 +255,7 @@ static void customConstruct(QVariant::Private *d, const void *copy)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QVariant::Private::canUseInternalSpace(size)) {
|
if (QVariant::Private::canUseInternalSpace(size, type.alignOf())) {
|
||||||
type.construct(&d->data, copy);
|
type.construct(&d->data, copy);
|
||||||
d->is_shared = false;
|
d->is_shared = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -426,10 +426,11 @@ class Q_CORE_EXPORT QVariant
|
|||||||
{
|
{
|
||||||
static constexpr size_t MaxInternalSize = 3*sizeof(void *);
|
static constexpr size_t MaxInternalSize = 3*sizeof(void *);
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static constexpr bool CanUseInternalSpace = (sizeof(T) <= MaxInternalSize);
|
static constexpr bool CanUseInternalSpace = (sizeof(T) <= MaxInternalSize && alignof(T) <= alignof(void *));
|
||||||
static constexpr bool canUseInternalSpace(size_t s) { return s <= MaxInternalSize; }
|
static constexpr bool canUseInternalSpace(size_t s, size_t align)
|
||||||
|
{ return s <= MaxInternalSize && align <= alignof(void *); }
|
||||||
|
|
||||||
alignas(std::max_align_t) union
|
union
|
||||||
{
|
{
|
||||||
uchar data[MaxInternalSize] = {};
|
uchar data[MaxInternalSize] = {};
|
||||||
PrivateShared *shared;
|
PrivateShared *shared;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user