summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-01-18 19:01:04 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-01-19 13:58:22 +0100
commit49e263ef4b1f5e03012a64ec137f3f3fc540ca9b (patch)
treece5e5856a60f73f06206494257d2be176d06051a /src/corelib
parenta5229a57effb36a0ad42120829017c03ccf8982d (diff)
QPropertyBindingPrivate: move static_assert()s to .cpp file
One of them has managed to percolate up to the top of the Clang -ftime-trace list of expensive template instantiations when building libQt6Gui.so with -pch: **** Templates that took longest to instantiate: 7882 ms: std::is_trivially_destructible<QPropertyBindingSourceLocation> (135 times, avg 58 ms) The checks aren't really necessary, because the compiler would complain about the union's deleted dtor if any of the members were not trivially destructible. Keep it around, though, but in the .cpp file. Task-number: QTBUG-97601 Pick-to: 6.3 6.2 Change-Id: I74a513a907735bde298e0bd9557d10abbcee5c91 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qproperty.cpp5
-rw-r--r--src/corelib/kernel/qproperty_p.h3
2 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp
index a4135b1f6f..32b8882369 100644
--- a/src/corelib/kernel/qproperty.cpp
+++ b/src/corelib/kernel/qproperty.cpp
@@ -267,6 +267,11 @@ void Qt::endPropertyUpdateGroup()
}
}
+// check everything stored in QPropertyBindingPrivate's union is trivially destructible
+// (though the compiler would also complain if that weren't the case)
+static_assert(std::is_trivially_destructible_v<QPropertyBindingSourceLocation>);
+static_assert(std::is_trivially_destructible_v<std::byte[sizeof(QPropertyBindingSourceLocation)]>);
+
QPropertyBindingPrivate::~QPropertyBindingPrivate()
{
if (firstObserver)
diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h
index 5105fd6343..d80ed21102 100644
--- a/src/corelib/kernel/qproperty_p.h
+++ b/src/corelib/kernel/qproperty_p.h
@@ -254,9 +254,8 @@ protected:
is stored somewhere else. To make efficient use of the space, we instead provide a scratch space
for QQmlPropertyBinding (which stores further binding information there).
Anything stored in the union must be trivially destructible.
+ (checked in qproperty.cpp)
*/
- static_assert(std::is_trivially_destructible_v<QPropertyBindingSourceLocation>);
- static_assert(std::is_trivially_destructible_v<std::byte[sizeof(QPropertyBindingSourceLocation)]>);
using DeclarativeErrorCallback = void(*)(QPropertyBindingPrivate *);
union {
QPropertyBindingSourceLocation location;