summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-08-26 14:34:11 +0200
committerLars Knoll <lars.knoll@qt.io>2020-08-26 17:34:55 +0200
commita5c71e4366cc048858c08ed308be694bde053da7 (patch)
treec0a62b9c49c257781fb947d667587d0617d1aead
parent639c2e7f20a409915510892d3d0f8d5b4f4865e2 (diff)
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>
-rw-r--r--src/corelib/kernel/qvariant.cpp2
-rw-r--r--src/corelib/kernel/qvariant.h7
2 files changed, 5 insertions, 4 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 1bc676a36c..4f92a81cf1 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -255,7 +255,7 @@ static void customConstruct(QVariant::Private *d, const void *copy)
return;
}
- if (QVariant::Private::canUseInternalSpace(size)) {
+ if (QVariant::Private::canUseInternalSpace(size, type.alignOf())) {
type.construct(&d->data, copy);
d->is_shared = false;
} else {
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 997b7ddd4a..b2b72523a9 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -426,10 +426,11 @@ class Q_CORE_EXPORT QVariant
{
static constexpr size_t MaxInternalSize = 3*sizeof(void *);
template<typename T>
- static constexpr bool CanUseInternalSpace = (sizeof(T) <= MaxInternalSize);
- static constexpr bool canUseInternalSpace(size_t s) { return s <= MaxInternalSize; }
+ static constexpr bool CanUseInternalSpace = (sizeof(T) <= MaxInternalSize && alignof(T) <= alignof(void *));
+ 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] = {};
PrivateShared *shared;