Skip to content

Commit 784214a

Browse files
committed
Do not warn for truncLongCastReturn if operands have known valid int value
1 parent f7130c3 commit 784214a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/checktype.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ void CheckType::checkLongCast()
383383
const ValueType *type = tok->astOperand1()->valueType();
384384
if (type && checkTypeCombination(*type, *retVt, *mSettings) &&
385385
type->pointer == 0U &&
386-
type->originalTypeName.empty())
386+
type->originalTypeName.empty() &&
387+
!tok->astOperand1()->hasKnownIntValue())
387388
ret = tok;
388389
}
389390
// All return statements must have problem otherwise no warning

0 commit comments

Comments
 (0)