diff options
-rw-r--r-- | src/corelib/kernel/qobject.h | 5 | ||||
-rw-r--r-- | tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 2 |
2 files changed, 2 insertions, 5 deletions
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index f1e0662461..f64a1a3b08 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -481,8 +481,7 @@ inline T qobject_cast(const QObject *object) } -template <class T> inline const char * qobject_interface_iid() -{ return nullptr; } +template <class T> constexpr const char * qobject_interface_iid() = delete; inline const QBindingStorage *qGetBindingStorage(const QObject *o) { @@ -497,7 +496,7 @@ inline QBindingStorage *qGetBindingStorage(QObject *o) # define Q_DECLARE_INTERFACE(IFace, IId) #elif !defined(Q_MOC_RUN) # define Q_DECLARE_INTERFACE(IFace, IId) \ - template <> inline const char *qobject_interface_iid<IFace *>() \ + template <> constexpr const char *qobject_interface_iid<IFace *>() \ { return IId; } \ template <> inline IFace *qobject_cast<IFace *>(QObject *object) \ { return reinterpret_cast<IFace *>((object ? object->qt_metacast(IId) : nullptr)); } \ diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 52b687cbfa..da62d73824 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -3582,8 +3582,6 @@ void tst_QObject::interfaceIid() QByteArray(Bleh_iid)); QCOMPARE(QByteArray(qobject_interface_iid<Foo::Bar *>()), QByteArray("com.qtest.foobar")); - QCOMPARE(QByteArray(qobject_interface_iid<FooObject *>()), - QByteArray()); } void tst_QObject::deleteQObjectWhenDeletingEvent() |