summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tools/moc/preprocessor.cpp16
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp4
2 files changed, 12 insertions, 8 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index f5639ffe31..32c94639ab 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -236,7 +236,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
data -= 2;
break;
case DIGIT:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (!*data || *data != '.') {
token = INTEGER_LITERAL;
@@ -244,7 +244,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
(*data == 'x' || *data == 'X')
&& *lexem == '0') {
++data;
- while (is_hex_char(*data))
+ while (is_hex_char(*data) || *data == '\'')
++data;
}
break;
@@ -253,13 +253,13 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
++data;
Q_FALLTHROUGH();
case FLOATING_LITERAL:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (*data == '+' || *data == '-')
++data;
if (*data == 'e' || *data == 'E') {
++data;
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
}
if (*data == 'f' || *data == 'F'
@@ -413,7 +413,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
token = PP_CHARACTER_LITERAL;
break;
case PP_DIGIT:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (!*data || *data != '.') {
token = PP_INTEGER_LITERAL;
@@ -421,7 +421,7 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
(*data == 'x' || *data == 'X')
&& *lexem == '0') {
++data;
- while (is_hex_char(*data))
+ while (is_hex_char(*data) || *data == '\'')
++data;
}
break;
@@ -430,13 +430,13 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
++data;
Q_FALLTHROUGH();
case PP_FLOATING_LITERAL:
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
if (*data == '+' || *data == '-')
++data;
if (*data == 'e' || *data == 'E') {
++data;
- while (is_digit_char(*data))
+ while (is_digit_char(*data) || *data == '\'')
++data;
}
if (*data == 'f' || *data == 'F'
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index e704a6877e..98429a1f0d 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -521,6 +521,10 @@ public slots:
private:
myNS::Points m_points;
+#ifdef Q_MOC_RUN
+ int xx = 11'11; // digit separator must not confuse moc (QTBUG-59351)
+#endif
+
private slots:
inline virtual void blub1() {}
virtual inline void blub2() {}