diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 306af0b0de8..59f41c3810a 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -905,7 +905,7 @@ void Preprocessor::skipPreprocesorDirective(PPToken *tk) bool Preprocessor::handleIdentifier(PPToken *tk) { - ScopedBoolSwap s(m_state.m_inPreprocessorDirective, true); + ScopedBoolSwap s(m_state.m_inPreprocessorDirective, !tk->f.expanded); static const QByteArray ppLine("__LINE__"); static const QByteArray ppFile("__FILE__"); diff --git a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp index 4b21a5895b7..108ff90ab3c 100644 --- a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp +++ b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp @@ -1877,21 +1877,27 @@ void tst_Preprocessor::concat() "#define concat(x,y) x ## y\n" "#define xconcat(x, y) concat(x, y)\n" "#define FOO 42\n" - "int var = xconcat(0x, FOO);\n"; + "int var1 = concat(0x, FOO);\n" + "int var2 = xconcat(0x, FOO);\n"; QByteArray prep = preprocess.run(QLatin1String(""), input); const QByteArray output = _( "# 1 \"\"\n" "\n" "\n" "\n" - "int var =\n" - "# expansion begin 87,7 ~1\n" - "0x42\n" + "int var1 =\n" + "# expansion begin 88,6 ~1\n" + "0xFOO\n" "# expansion end\n" "# 4 \"\"\n" " ;\n" + "int var2 =\n" + "# expansion begin 116,7 ~1\n" + "0x42\n" + "# expansion end\n" + "# 5 \"\"\n" + " ;\n" ); - QEXPECT_FAIL(0, "QTCREATORBUG-13219", Abort); QCOMPARE(prep.constData(), output.constData()); }