diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2013-03-04 16:52:12 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-14 09:42:53 +0100 |
commit | 2b26f801b5b49e2f354da0b67070917d25d5917d (patch) | |
tree | c3542211d7827e2d05cbf18281af00c16d99e89b /tests/auto/tools | |
parent | 8e261ac756132baeb857fb15013cde126ffa22cc (diff) |
Make parsing of template arguments more robust.
At first, my goal was just to fix Moc::until() to parse properly
template arguments containing expressions containing > or >>
such as Foo<(8>>2)>
But with the test, I realized that normalizeType also requires change
not to split the > > too much.
And QMetaObjectPrivate::decodeMethodSignature should not interpret
the ) within the template parameter as the end of the function.
Change-Id: Ia9d3a2a786368aeda1edcf66280d70f64cf05070
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r-- | tests/auto/tools/moc/tst_moc.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 8ce55cbdf5..e26b02a560 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -1538,13 +1538,30 @@ class QTBUG12260_defaultTemplate_Object : public QObject public slots: #if !(defined(Q_CC_GNU) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) || defined(Q_MOC_RUN) void doSomething(QHash<QString, QVariant> values = QHash<QString, QVariant>() ) { Q_UNUSED(values); } + void doSomethingElse(QSharedPointer<QVarLengthArray<QString, (16 >> 2)> > val + = QSharedPointer<QVarLengthArray<QString, (16 >> 2)> >() ) + { Q_UNUSED(val); } #else // we want to test the previous function, but gcc < 4.4 seemed to have a bug similar to the one moc has. typedef QHash<QString, QVariant> WorkaroundGCCBug; void doSomething(QHash<QString, QVariant> values = WorkaroundGCCBug() ) { Q_UNUSED(values); } + void doSomethingElse(QSharedPointer<QVarLengthArray<QString, (16 >> 2)> > val + = (QSharedPointer<QVarLengthArray<QString, (16 >> 2)> >()) ) + { Q_UNUSED(val); } #endif void doAnotherThing(bool a = (1 < 3), bool b = (1 > 4)) { Q_UNUSED(a); Q_UNUSED(b); } + +#if defined(Q_MOC_RUN) || (defined(Q_COMPILER_AUTO_TYPE) && !(defined(Q_CC_CLANG) && (__clang_major__ * 100) + __clang_minor__) < 304) + // There is no Q_COMPILER_>> but if compiler support auto, it should also support >> + void performSomething(QVector<QList<QString>> e = QVector<QList<QString>>(8 < 1), + QHash<int, QVector<QString>> h = QHash<int, QVector<QString>>()) + { Q_UNUSED(e); Q_UNUSED(h); } +#else + void performSomething(QVector<QList<QString> > e = QVector<QList<QString> >(), + QHash<int, QVector<QString> > h = (QHash<int, QVector<QString> >())) + { Q_UNUSED(e); Q_UNUSED(h); } +#endif }; @@ -1552,6 +1569,8 @@ void tst_Moc::QTBUG12260_defaultTemplate() { QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doSomething(QHash<QString,QVariant>)") != -1); QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doAnotherThing(bool,bool)") != -1); + QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doSomethingElse(QSharedPointer<QVarLengthArray<QString,(16>>2)> >)") != -1); + QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("performSomething(QVector<QList<QString> >,QHash<int,QVector<QString> >)") != -1); } void tst_Moc::notifyError() |