summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-07-30 10:11:57 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-07-30 10:13:35 +0200
commit9523b27be4fe00870d19c4ff4caa2d78dcf520e6 (patch)
tree54a8dec77cf9f165072ebb48f9a74bbc78aa502e
parentd09fa4a816c6b9ccf306b7e1a887c4a4b1dc2f4e (diff)
parse Q_INVOKABLE explicit constructors
regression introduced in e43eae35 because the code of maybeParseFunction and parseFunction is not exactly the same. Reviewed-by: Kent Hansen
-rw-r--r--src/tools/moc/moc.cpp2
-rw-r--r--tests/auto/moc/tst_moc.cpp7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 797595f839..0ba7d538bb 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -429,7 +429,7 @@ bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def)
{
def->isVirtual = false;
//skip modifiers and attributes
- while (test(INLINE) || test(STATIC) ||
+ while (test(EXPLICIT) || test(INLINE) || test(STATIC) ||
(test(VIRTUAL) && (def->isVirtual = true)) //mark as virtual
|| testFunctionAttribute(def)) {}
bool tilde = test(TILDE);
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index d66791f17a..488f068e20 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -1157,6 +1157,13 @@ void tst_Moc::constructors()
QObject *o3 = mo->newInstance(Q_ARG(QString, str));
QVERIFY(o3 != 0);
QCOMPARE(qobject_cast<CtorTestClass*>(o3)->m_str, str);
+
+ {
+ //explicit constructor
+ QObject *o = QObject::staticMetaObject.newInstance();
+ QVERIFY(o);
+ delete o;
+ }
}
#include "task234909.h"