diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-07-21 08:15:25 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-07-21 08:16:48 (GMT) |
commit | 22e0ebd883256379d950ee94de9ba9c92ecf0113 (patch) | |
tree | 3083caf7e686d28f365e277e676044cb53c3ce61 /tests/auto/moc | |
parent | 2e63bd12bfe0a34f8708f99a0a97fc55d53cc229 (diff) | |
download | Qt-22e0ebd883256379d950ee94de9ba9c92ecf0113.zip Qt-22e0ebd883256379d950ee94de9ba9c92ecf0113.tar.gz Qt-22e0ebd883256379d950ee94de9ba9c92ecf0113.tar.bz2 |
tst_moc: workaround gcc bug.
The gcc bug was already work arounded, but moc did not understand the defines
and generated the slot anyway why it would not exist with gcc < 4.4
Diffstat (limited to 'tests/auto/moc')
-rw-r--r-- | tests/auto/moc/tst_moc.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index d871540..d3a7e03 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -1344,18 +1344,21 @@ signals: class QTBUG12260_defaultTemplate_Object : public QObject { Q_OBJECT public slots: -#if !(defined(Q_CC_GNU) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) //gcc bug, this does not compile - void doSomething(QHash<QString, QVariant> values = QHash<QString, QVariant>()) { Q_UNUSED(values); } +#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); } +#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); } #endif + void doAnotherThing(bool a = (1 < 3), bool b = (1 > 4)) { Q_UNUSED(a); Q_UNUSED(b); } }; void tst_Moc::QTBUG12260_defaultTemplate() { -#if !(defined(Q_CC_GNU) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doSomething(QHash<QString,QVariant>)") != -1); -#endif QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doAnotherThing(bool,bool)") != -1); } |