summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2024-01-18 09:11:03 +0100
committerMarc Mutz <marc.mutz@qt.io>2024-01-19 10:15:25 +0100
commit88c3cd6e08c86bfb5bb676ceed4c92344f8ed91c (patch)
tree114390e54f2635d6ae6ede04705bafc82f512f68 /src
parent3195e34742731406a923b545bd85a5a33e970a42 (diff)
QMetaTypeModuleHelper: mark instances constexpr
Static and thread-local objects should be constexpr or constinit if possible. Task-number: QTBUG-100485 Pick-to: 6.7 6.6 6.5 Change-Id: I29088798a50d6278252c9088e7c191c4214b2e5b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qmetatype.cpp2
-rw-r--r--src/gui/kernel/qguivariant.cpp2
-rw-r--r--src/widgets/kernel/qwidgetsvariant.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 3f22a05b07..a1310992f4 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -964,7 +964,7 @@ static const struct { const char * typeName; int typeNameLength; int type; } typ
};
// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor): this is not a base class
-static const struct : QMetaTypeModuleHelper
+static constexpr struct : QMetaTypeModuleHelper
{
template<typename T, typename LiteralWrapper =
std::conditional_t<std::is_same_v<T, QString>, QLatin1StringView, const char *>>
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 1b60c7c9d6..fe72e7782f 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
namespace {
// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor): this is not a base class
-static const struct : QMetaTypeModuleHelper
+static constexpr struct : QMetaTypeModuleHelper
{
#define QT_IMPL_METATYPEINTERFACE_GUI_TYPES(MetaTypeName, MetaTypeId, RealName) \
QT_METATYPE_INTERFACE_INIT(RealName),
diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp
index 459f95c0fb..17a19aa780 100644
--- a/src/widgets/kernel/qwidgetsvariant.cpp
+++ b/src/widgets/kernel/qwidgetsvariant.cpp
@@ -13,7 +13,7 @@ QT_BEGIN_NAMESPACE
namespace {
// NOLINTNEXTLINE(cppcoreguidelines-virtual-class-destructor): this is not a base class
-static const struct : QMetaTypeModuleHelper
+static constexpr struct : QMetaTypeModuleHelper
{
const QtPrivate::QMetaTypeInterface *interfaceForType(int type) const override {
switch (type) {