Fixed #7056 (iscast does not handle '(ulong)~0' properly, Tokenizer::simplifyCalculations wrongly simplifies '(ulong)~0' to 'ulong~0')
This commit is contained in:
parent
30af2fcd73
commit
ec87b09d89
|
@ -1006,7 +1006,7 @@ bool TemplateSimplifier::simplifyCalculations(Token *_tokens)
|
|||
// keep parentheses here: Functor()(a ... )
|
||||
// keep parentheses here: ) ( var ) ;
|
||||
if ((Token::Match(tok->next(), "( %name% ) ;|)|,|]") ||
|
||||
(Token::Match(tok->next(), "( %name% ) %cop%") && (tok->tokAt(2)->varId()>0 || !Token::Match(tok->tokAt(4), "[*&+-]")))) &&
|
||||
(Token::Match(tok->next(), "( %name% ) %cop%") && (tok->tokAt(2)->varId()>0 || !Token::Match(tok->tokAt(4), "[*&+-~]")))) &&
|
||||
!tok->isName() &&
|
||||
tok->str() != ">" &&
|
||||
tok->str() != ")" &&
|
||||
|
|
|
@ -955,12 +955,9 @@ private:
|
|||
|
||||
// #4899 - False positive on unused variable
|
||||
ASSERT_EQUALS("; float angle ; angle = tilt ;", tokenizeAndStringify("; float angle = (float) tilt;", true)); // status quo
|
||||
TODO_ASSERT_EQUALS("; float angle ; angle = - tilt ;",
|
||||
"; float angle ; angle = ( float ) - tilt ;",
|
||||
tokenizeAndStringify("; float angle = (float) -tilt;", true));
|
||||
TODO_ASSERT_EQUALS("; float angle ; angle = tilt ;",
|
||||
"; float angle ; angle = ( float ) + tilt ;",
|
||||
tokenizeAndStringify("; float angle = (float) +tilt;", true));
|
||||
ASSERT_EQUALS("; float angle ; angle = ( float ) - tilt ;", tokenizeAndStringify("; float angle = (float) -tilt;", true));
|
||||
ASSERT_EQUALS("; float angle ; angle = ( float ) + tilt ;", tokenizeAndStringify("; float angle = (float) +tilt;", true));
|
||||
ASSERT_EQUALS("; int a ; a = ( int ) ~ c ;", tokenizeAndStringify("; int a = (int)~c;", true));
|
||||
}
|
||||
|
||||
void removeCast14() { // const
|
||||
|
|
Loading…
Reference in New Issue