summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2023-03-13 17:59:35 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2023-06-17 06:06:56 +0000
commit439be6ac26be379bc9a4fd916e90f0ac83c015b5 (patch)
tree9c9fb10b3bba5f9f37853010bf9d14b9d4a933d0 /tests
parent4c4d21816db5f7fd4b43f90c44cc5922ae9f08c4 (diff)
moc: Handle attributes after meta-method tag
We so far only handled them if they came at the very start of the method declaration. This patch ensures that we also handle them after the meta-method tag (but before the actual type). Unifying parseFunction and parseMaybeFunction to avoid the need to munally keep them in sync is left for another day. Fixes: QTBUG-111330 Change-Id: Ic94edb69f04b9150aea2c8e6d004a8b9e5cf12ec Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 44b5ad01f0da55a351e0855e1173acfbef77221d) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 8d83c1d3b4..a988579f89 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -81,6 +81,19 @@ Q_DECLARE_METATYPE(const QMetaObject*);
#define TESTEXPORTMACRO Q_DECL_EXPORT
+#if !defined(Q_MOC_RUN) && !defined(Q_NOREPLY)
+# define Q_NOREPLY
+#endif
+
+struct TagTest : QObject {
+ Q_OBJECT
+
+ Q_INVOKABLE Q_NOREPLY inline int test() {return 0;}
+public slots:
+ Q_NOREPLY virtual inline void pamOpen(int){}
+};
+
+
namespace TestNonQNamespace {
struct TestGadget {
@@ -760,6 +773,7 @@ private slots:
void setQPRopertyBinding();
void privateQPropertyShim();
void readWriteThroughBindable();
+ void virtualInlineTaggedSlot();
signals:
void sigWithUnsignedArg(unsigned foo);
@@ -4435,6 +4449,20 @@ void tst_Moc::readWriteThroughBindable()
}
}
+void tst_Moc::virtualInlineTaggedSlot()
+{
+ auto mo = TagTest::staticMetaObject;
+ auto idx = mo.indexOfMethod("pamOpen(int)");
+ auto method = mo.method(idx);
+ QVERIFY(method.isValid()); // fails!
+ QCOMPARE(method.tag(), "Q_NOREPLY");
+ idx = mo.indexOfMethod("test()");
+ method = mo.method(idx);
+ QVERIFY(method.isValid());
+ QCOMPARE(method.tag(), "Q_NOREPLY");
+ QCOMPARE(method.returnMetaType(), QMetaType::fromType<int>());
+}
+
QTEST_MAIN(tst_Moc)
// the generated code must compile with QT_NO_KEYWORDS