fix #3194 (Parsing glitch causes false 'can be const' error for an 'if' statement)
This commit is contained in:
parent
af6a6f9c2d
commit
ee04c1bfb7
|
@ -10985,7 +10985,7 @@ void Tokenizer::simplifyOperatorName()
|
|||
par = par->next();
|
||||
done = false;
|
||||
}
|
||||
if (Token::Match(par, "=|.|%op%"))
|
||||
if (Token::Match(par, "=|.|++|--|%op%"))
|
||||
{
|
||||
op += par->str();
|
||||
par = par->next();
|
||||
|
|
|
@ -348,6 +348,7 @@ private:
|
|||
TEST_CASE(simplifyOperatorName3);
|
||||
TEST_CASE(simplifyOperatorName4);
|
||||
TEST_CASE(simplifyOperatorName5);
|
||||
TEST_CASE(simplifyOperatorName6); // ticket #3194
|
||||
|
||||
// Some simple cleanups of unhandled macros in the global scope
|
||||
TEST_CASE(removeMacrosInGlobalScope);
|
||||
|
@ -5929,6 +5930,17 @@ private:
|
|||
ASSERT_EQUALS(result2, tokenizeAndStringify(code2,false));
|
||||
}
|
||||
|
||||
void simplifyOperatorName6() // ticket #3195
|
||||
{
|
||||
const char code1[] = "value_type * operator ++ (int);";
|
||||
const char result1[] = "value_type * operator++ ( int ) ;";
|
||||
ASSERT_EQUALS(result1, tokenizeAndStringify(code1,false));
|
||||
|
||||
const char code2[] = "value_type * operator -- (int);";
|
||||
const char result2[] = "value_type * operator-- ( int ) ;";
|
||||
ASSERT_EQUALS(result2, tokenizeAndStringify(code2,false));
|
||||
}
|
||||
|
||||
void removeMacrosInGlobalScope()
|
||||
{
|
||||
// remove some unhandled macros in the global scope.
|
||||
|
|
Loading…
Reference in New Issue