TemplateSimplifier: Fixed bug in simplifyCalculations. Now template58 test case does not throw InternalError
This commit is contained in:
parent
d2e7df2c04
commit
cb48e63f92
|
@ -1137,11 +1137,10 @@ bool TemplateSimplifier::simplifyCalculations(Token *_tokens)
|
|||
}
|
||||
|
||||
if (Token::Match(tok->tokAt(-2), "%any% * 1") || Token::Match(tok->previous(), "%any% 1 *")) {
|
||||
if (tok->isNumber())
|
||||
tok = tok->previous();
|
||||
tok = tok->previous();
|
||||
tok->deleteNext();
|
||||
tok->deleteNext();
|
||||
if (tok->str() == "*")
|
||||
tok = tok->previous();
|
||||
tok->deleteNext(2);
|
||||
ret = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1056,7 +1056,13 @@ private:
|
|||
"void foo() {\n"
|
||||
" TestArithmetic<int>();\n"
|
||||
"}";
|
||||
ASSERT_THROW(tok(code), InternalError);
|
||||
const char exp[] = "void foo ( ) {"
|
||||
" TestArithmetic < int > ( ) ; "
|
||||
"} "
|
||||
"void TestArithmetic < int > ( ) {"
|
||||
" x ( CheckedNumeric < int > ( ) ) ; "
|
||||
"}";
|
||||
ASSERT_EQUALS(exp, tok(code));
|
||||
}
|
||||
|
||||
void template_enum() {
|
||||
|
|
Loading…
Reference in New Issue