diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 199fbb993..d3ae860ea 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3111,7 +3111,7 @@ void Tokenizer::simplifyArrayAccessSyntax() void Tokenizer::simplifyParameterVoid() { for (Token* tok = list.front(); tok; tok = tok->next()) { - if (Token::Match(tok, "%name% ( void )") && !Token::Match(tok, "sizeof|decltype|typeof")) { + if (Token::Match(tok, "%name% ( void )") && !Token::Match(tok, "sizeof|decltype|typeof|return")) { tok->next()->deleteNext(); tok->next()->setRemovedVoidParameter(true); } diff --git a/test/testincompletestatement.cpp b/test/testincompletestatement.cpp index 8f6bc0e0c..eefe58854 100644 --- a/test/testincompletestatement.cpp +++ b/test/testincompletestatement.cpp @@ -372,6 +372,12 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + check("void g();\n" // #10952 + "bool f() {\n" + " return (void)g(), false;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + check("void f(int a, int b, int c, int d) {\n" " Eigen::Vector4d V;\n" " V << a, b, c, d;\n"