3.32 Out-of-range Enum
Older versions of Solidity
produced unexpected behavior with out-of-range enums. For example we had enum E{a}
(with a single member a
) as shown here, then E(1)
is out-of-range because, remember, indexing of enum
members begins with 0.
So E(1)
here is out-of-range because there's a single mapper. This out-of-range enum
produced unexpected behavior in Solidity < 0.4.5
. This was due to a compiler bug which has since been fixed.
The best practice until the fix was applied was to check the use of enums
to make sure they are not out-of-range.
Last updated