Fixed #5261 (AST: cast not handled well (a::b&)x)
This commit is contained in:
parent
aa65799c19
commit
915cb6c757
|
@ -363,7 +363,7 @@ static bool iscast(const Token *tok)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (const Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
|
for (const Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
|
||||||
if (!Token::Match(tok2, "%var%|*"))
|
if (!Token::Match(tok2, "%var%|*|&|::"))
|
||||||
return Token::Match(tok2, ") %any%") && (!tok2->next()->isOp() && tok2->next()->str() != "[");
|
return Token::Match(tok2, ") %any%") && (!tok2->next()->isOp() && tok2->next()->str() != "[");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,8 +531,6 @@ static void compileMulDiv(Token *&tok, std::stack<Token*> &op)
|
||||||
compileDot(tok,op);
|
compileDot(tok,op);
|
||||||
while (tok) {
|
while (tok) {
|
||||||
if (Token::Match(tok, "[*/%]")) {
|
if (Token::Match(tok, "[*/%]")) {
|
||||||
if (Token::Match(tok, "* [,)]"))
|
|
||||||
break;
|
|
||||||
compileBinOp(tok, compileDot, op);
|
compileBinOp(tok, compileDot, op);
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10033,6 +10033,9 @@ private:
|
||||||
// casts
|
// casts
|
||||||
ASSERT_EQUALS("a1(2(+=",testAst("a=(t)1+(t)2;"));
|
ASSERT_EQUALS("a1(2(+=",testAst("a=(t)1+(t)2;"));
|
||||||
ASSERT_EQUALS("a1(2+=",testAst("a=(t)1+2;"));
|
ASSERT_EQUALS("a1(2+=",testAst("a=(t)1+2;"));
|
||||||
|
ASSERT_EQUALS("a1(2+=",testAst("a=(t*)1+2;"));
|
||||||
|
ASSERT_EQUALS("a1(2+=",testAst("a=(t&)1+2;"));
|
||||||
|
ASSERT_EQUALS("ab::r&c(=", testAst("a::b& r = (a::b&)c;")); // #5261
|
||||||
|
|
||||||
// ({..})
|
// ({..})
|
||||||
ASSERT_EQUALS("a{+d+", testAst("a+({b+c;})+d"));
|
ASSERT_EQUALS("a{+d+", testAst("a+({b+c;})+d"));
|
||||||
|
|
Loading…
Reference in New Issue