diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 9d102bd44..c5ac76e2f 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -1703,7 +1703,7 @@ public: } optcomma = false; macrocode += str; - if (Token::Match(tok, "%type% %var%")) + if (Token::Match(tok, "%var% %var%")) macrocode += " "; } } diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 11ed8bff0..3f630cbe2 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -123,6 +123,7 @@ private: TEST_CASE(macro_simple8); TEST_CASE(macro_simple9); TEST_CASE(macro_simple10); + TEST_CASE(macro_simple11); TEST_CASE(macroInMacro); TEST_CASE(macro_mismatch); TEST_CASE(macro_linenumbers); @@ -1012,6 +1013,13 @@ private: ASSERT_EQUALS("\nunsigned long x;", OurPreprocessor::expandMacros(filedata)); } + void macro_simple11() + { + const char filedata[] = "#define ABC(x) delete x\n" + "ABC(a);"; + ASSERT_EQUALS("\ndelete a;", OurPreprocessor::expandMacros(filedata)); + } + void macroInMacro() { {