diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2014-02-13 11:13:30 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-14 14:33:17 +0100 |
commit | 2b0f02aa5cc0f7d1b460d2d324d5d08c6f6d61b9 (patch) | |
tree | 2fa11719122b2a296af3052ed466a816e0711c76 | |
parent | 4179302d6572c6d898a61cf19f3f3b96ef3d9574 (diff) | |
download | qtbase-2b0f02aa5cc0f7d1b460d2d324d5d08c6f6d61b9.tar.gz qtbase-2b0f02aa5cc0f7d1b460d2d324d5d08c6f6d61b9.tar.bz2 qtbase-2b0f02aa5cc0f7d1b460d2d324d5d08c6f6d61b9.zip |
moc: Fix parsing of operator<
moc would skip the 'operator' keyword as unknown and try to parse a type again
but as it sees the '<' it looks for the corresponding '>' which does not exist
types can't start with '<' anyway, so return an invalid type and continue
parsing as usual
Task-number: QTBUG-36834
Change-Id: If3d27076ef9947abf8c57c594713eece9334d0b0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
-rw-r--r-- | src/tools/moc/moc.cpp | 4 | ||||
-rw-r--r-- | tests/auto/tools/moc/tst_moc.cpp | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 22cbb97364..b26fac5dcf 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -224,6 +224,10 @@ Type Moc::parseType() ; } if (test(LANGLE)) { + if (type.name.isEmpty()) { + // '<' cannot start a type + return type; + } type.name += lexemUntil(RANGLE); } if (test(SCOPE)) { diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index e26b02a560..bf2d6afdb4 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -128,6 +128,7 @@ public: emit send(value); } + bool operator< ( const Sender & ) const { /* QTBUG-36834 */ return true;} signals: void send(const String::Type&); void send(const Int::Type&); |