summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tools/moc/preprocessor.cpp6
-rw-r--r--tests/auto/tools/moc/parse-defines.h3
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp3
3 files changed, 9 insertions, 3 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 5ce28d931b..11bf8d7937 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -696,9 +696,9 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
next = arg.at(0);
}
- Symbol last = expansion.constLast();
- if (!expansion.isEmpty() && last.token == s.token && last.token != STRING_LITERAL) {
- expansion.pop_back();
+ if (!expansion.isEmpty() && expansion.constLast().token == s.token
+ && expansion.constLast().token != STRING_LITERAL) {
+ Symbol last = expansion.takeLast();
QByteArray lexem = last.lexem() + next.lexem();
expansion += Symbol(lineNum, last.token, lexem);
diff --git a/tests/auto/tools/moc/parse-defines.h b/tests/auto/tools/moc/parse-defines.h
index 9fb5da4b07..6100bf67ad 100644
--- a/tests/auto/tools/moc/parse-defines.h
+++ b/tests/auto/tools/moc/parse-defines.h
@@ -139,6 +139,9 @@ public slots:
signals:
DEFINE_CMDLINE_SIGNAL;
+#define QTBUG55853(X) PD_DEFINE1(X, signalQTBUG55853)
+#define PD_EMPTY /* empty */
+ void QTBUG55853(PD_EMPTY)();
};
#undef QString
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index a3648c95b6..601b1bb36b 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -3397,6 +3397,9 @@ void tst_Moc::parseDefines()
index = mo->indexOfSignal("cmdlineSignal(QMap<int,int>)");
QVERIFY(index != -1);
+
+ index = mo->indexOfSignal("signalQTBUG55853()");
+ QVERIFY(index != -1);
}
void tst_Moc::preprocessorOnly()