From bc7e63385522c2020168cf367a8b3b1e6c6bc65e Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Mon, 19 Sep 2022 12:23:04 +0200 Subject: moc: Do not fail to compile meta-methods containing non-const ref types Amends 2d0c31e7d92a3e9df4ce2b9c1d41b94fb12735fc. We were using MetaTypeDecay in qTryMetaTypeInterfaceForType; but that is not used by moc when complete types are enforced. Change qt_metaTypeArray to also use qTryMetaTypeInterfaceForType, so that the code path for "force complete types"[0] and the normal one do not diverge. [0] Most easily enabled by using one of the QML type registration macros. Fixes: QTBUG-106672 Change-Id: I9bf14873d1d0c4127a676643f7e8eb77f6e42dc8 Reviewed-by: Volker Hilsheimer (cherry picked from commit a8ccd9cd848be9aafd2d07d83a8897dc8b2a0cb3) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/kernel/qmetatype.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/corelib/kernel/qmetatype.h') diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 70cf942a4a..9a19402b64 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -2512,7 +2512,14 @@ constexpr const QMetaObject *QMetaType::metaObject() const template constexpr const QtPrivate::QMetaTypeInterface *const qt_metaTypeArray[] = { - QtPrivate::qMetaTypeInterfaceForType()... + /* + Unique in qTryMetaTypeInterfaceForType does not have to be unique here + as we require _all_ types here to be actually complete. + We just want to have the additional type processing that exist in + QtPrivate::qTryMetaTypeInterfaceForType as opposed to the normal + QtPrivate::qMetaTypeInterfaceForType used in QMetaType::fromType + */ + QtPrivate::qTryMetaTypeInterfaceForType>()... }; constexpr const char *QMetaType::name() const -- cgit v1.2.3