Mettle

M0118Integer out of range for its destination

Reported by the compiler as an error or warning.

mettle explain M0118

A compile-time integer is stored somewhere that cannot hold it. The value is known here, so this is a fact rather than a risk: the store would keep the low bits and discard the rest.

Example

var h: int32 = 2654435761;    // M0118: int32 holds ..2147483647

Fixes

The last one is not a workaround. A cast at the site is how a reader learns the truncation was intended, which is the whole reason this is reported instead of performed.

Related