Fix #10952 FP constStatement with cast in return (#3986)

This commit is contained in:
chrchr-github 2022-04-07 14:11:14 +02:00 committed by GitHub
parent 4c1aeb0cb1
commit ceb86afc22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -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);
}

View File

@ -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"