Fixed #7481 (False positive AssignmentAddressToInteger - pointer to enum)
This commit is contained in:
parent
9bcb36e0bb
commit
be90080976
|
@ -4047,7 +4047,7 @@ static void setValueType(Token *tok, const Variable &var, bool cpp, ValueType::S
|
||||||
setValueType(tok, valuetype, cpp, defaultSignedness, lib);
|
setValueType(tok, valuetype, cpp, defaultSignedness, lib);
|
||||||
valuetype.originalTypeName = var.type()->classScope->className;
|
valuetype.originalTypeName = var.type()->classScope->className;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (parsedecl(var.typeStartToken(), &valuetype, defaultSignedness, lib)) {
|
||||||
valuetype.sign = ValueType::SIGNED;
|
valuetype.sign = ValueType::SIGNED;
|
||||||
valuetype.type = ValueType::INT;
|
valuetype.type = ValueType::INT;
|
||||||
setValueType(tok, valuetype, cpp, defaultSignedness, lib);
|
setValueType(tok, valuetype, cpp, defaultSignedness, lib);
|
||||||
|
|
|
@ -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("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 *p; a = p++;", "++"));
|
||||||
ASSERT_EQUALS("signed int", typeOf("int x; a = x++;", "++"));
|
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
|
// Unary arithmetic/bit operators
|
||||||
ASSERT_EQUALS("signed int", typeOf("int x; a = -x;", "-"));
|
ASSERT_EQUALS("signed int", typeOf("int x; a = -x;", "-"));
|
||||||
|
|
Loading…
Reference in New Issue