When constructing or assigning to a Checked!int with a custom hook that define min and max, these min and max values are ignored.
import std.experimental.checkedint;
struct MyHook {
enum min(T) = 3;
enum max(T) = 15;
static B onLowerBound(T, B)(T value, B bound)
{
assert(0);
}
static B onUpperBound(T, B)(T value, B bound)
{
assert(0);
}
}
unittest
{
// This should trigger one of the above asserts:
Checked!(int, MyHook) a = 500;
// As should this:
a = 22;
// Instead, Checked blithely ignores the limits, and this assert triggers:
assert(a != 22);
}