Fixed #7481 (False positive AssignmentAddressToInteger - pointer to enum)

This commit is contained in:
Daniel Marjamäki 2016-05-07 19:51:37 +02:00
parent 9bcb36e0bb
commit be90080976
2 changed files with 2 additions and 1 deletions

View File

@ -4047,7 +4047,7 @@ static void setValueType(Token *tok, const Variable &var, bool cpp, ValueType::S
setValueType(tok, valuetype, cpp, defaultSignedness, lib);
valuetype.originalTypeName = var.type()->classScope->className;
}
} else {
} else if (parsedecl(var.typeStartToken(), &valuetype, defaultSignedness, lib)) {
valuetype.sign = ValueType::SIGNED;
valuetype.type = ValueType::INT;
setValueType(tok, valuetype, cpp, defaultSignedness, lib);

View File

@ -3220,6 +3220,7 @@ private:
ASSERT_EQUALS("signed int", typeOf("struct X {int i;}; void f(struct X x) { x.i }", "."));
ASSERT_EQUALS("signed int *", typeOf("int *p; a = p++;", "++"));
ASSERT_EQUALS("signed int", typeOf("int x; a = x++;", "++"));
ASSERT_EQUALS("signed int *", typeOf("enum AB {A,B}; enum AB *ab; x=ab+2;", "+"));
// Unary arithmetic/bit operators
ASSERT_EQUALS("signed int", typeOf("int x; a = -x;", "-"));