Fixed #8462 (AST: no ast created for 'e = { std::move(address),httpPort, (httpsPort) };')

This commit is contained in:
Daniel Marjamäki 2018-03-27 13:44:28 +02:00
parent c76b593467
commit 210b921062
2 changed files with 7 additions and 0 deletions

View File

@ -401,6 +401,12 @@ static bool iscast(const Token *tok)
if (Token::Match(tok, "( (| typeof (") && Token::Match(tok->link(), ") %num%"))
return true;
if (Token::Match(tok->link(), ") }|)|]"))
return false;
if (Token::Match(tok->link(), ") %cop%") && !Token::Match(tok->link(), ") [&*+-~]"))
return false;
if (Token::Match(tok->previous(), "= ( %name% ) {") && tok->next()->varId() == 0)
return true;

View File

@ -8324,6 +8324,7 @@ private:
ASSERT_EQUALS("s0[L.2[x={=", testAst("s = { [0].L[2] = x};"));
ASSERT_EQUALS("ac.0={(=", testAst("a = (b){.c=0,};")); // <- useless comma
ASSERT_EQUALS("xB[1y.z.1={(&=,{={=", testAst("x = { [B] = {1, .y = &(struct s) { .z=1 } } };"));
ASSERT_EQUALS("xab,c,{=", testAst("x={a,b,(c)};"));
// struct initialization hang
ASSERT_EQUALS("sbar.1{,{(={= fcmd( forfieldfield++;;(",