parent
81bcbfa7fe
commit
86ff360946
|
@ -8870,9 +8870,11 @@ bool Tokenizer::simplifyRedundantParentheses()
|
|||
if (tok->str() != "(")
|
||||
continue;
|
||||
|
||||
if (isCPP() && Token::simpleMatch(tok->previous(), "} (") &&
|
||||
Token::Match(tok->previous()->link()->previous(), "%name%|> {"))
|
||||
continue;
|
||||
if (isCPP() && Token::simpleMatch(tok->previous(), "} (")) {
|
||||
const Token* plp = tok->previous()->link()->previous();
|
||||
if (Token::Match(plp, "%name%|>|] {") || (Token::simpleMatch(plp, ")") && Token::simpleMatch(plp->link()->previous(), "]")))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Token::simpleMatch(tok, "( {"))
|
||||
continue;
|
||||
|
|
|
@ -579,6 +579,12 @@ private:
|
|||
" E e = (E)!s->i;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("struct S { int i; };\n" // #10917
|
||||
"bool f(S s) {\n"
|
||||
" return [](int i) { return i > 0; }(s.i);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void vardecl() {
|
||||
|
|
Loading…
Reference in New Issue