- fixed: explicit float to int casts should not emit truncation warnings.

This commit is contained in:
Christoph Oelckers 2021-05-19 18:35:36 +02:00
parent f0d8bd0a74
commit bd0ca55a35

View file

@ -932,7 +932,7 @@ FxExpression *FxIntCast::Resolve(FCompileContext &ctx)
{ {
ExpVal constval = static_cast<FxConstant *>(basex)->GetValue(); ExpVal constval = static_cast<FxConstant *>(basex)->GetValue();
FxExpression *x = new FxConstant(constval.GetInt(), ScriptPosition); FxExpression *x = new FxConstant(constval.GetInt(), ScriptPosition);
if (constval.GetInt() != constval.GetFloat()) if (constval.GetInt() != constval.GetFloat() && !Explicit)
{ {
ScriptPosition.Message(MSG_WARNING, "Truncation of floating point constant %f", constval.GetFloat()); ScriptPosition.Message(MSG_WARNING, "Truncation of floating point constant %f", constval.GetFloat());
} }