ValueFlow: Set value for ::
This commit is contained in:
parent
574141a492
commit
9a2b71494f
|
@ -1047,6 +1047,10 @@ static void setTokenValue(Token* tok, const ValueFlow::Value &value, const Setti
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (Token::Match(parent, ":: %name%") && parent->astOperand2() == tok) {
|
||||
setTokenValue(parent, value, settings);
|
||||
}
|
||||
}
|
||||
|
||||
static void setTokenValueCast(Token *parent, const ValueType &valueType, const ValueFlow::Value &value, const Settings *settings)
|
||||
|
|
|
@ -331,6 +331,13 @@ private:
|
|||
ASSERT_EQUALS((int)('a'), valueOfTok("x='a';", "'a'").intvalue);
|
||||
ASSERT_EQUALS((int)('\n'), valueOfTok("x='\\n';", "'\\n'").intvalue);
|
||||
ASSERT_EQUALS(0xFFFFFFFF00000000, valueOfTok("x=0xFFFFFFFF00000000;","18446744069414584320U").intvalue); // #7701
|
||||
|
||||
// scope
|
||||
{
|
||||
const char code[] = "namespace N { enum E {e0,e1}; }\n"
|
||||
"void foo() { x = N::e1; }";
|
||||
ASSERT_EQUALS(1, valueOfTok(code, "::").intvalue);
|
||||
}
|
||||
}
|
||||
|
||||
void valueFlowString() {
|
||||
|
|
Loading…
Reference in New Issue