Could that bug be catch using D's way?
Simen Kjærås
simen.kjaras at gmail.com
Mon Feb 19 13:51:50 UTC 2018
On Monday, 19 February 2018 at 13:33:34 UTC, rikki cattermole
wrote:
> https://dlang.org/phobos/std_experimental_checkedint.html#.Checked.min
Can't seem to get that to work, so I assumed it's not meant to be
used that way:
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
{
Checked!(int, MyHook) a;
a = 22;
assert(a != 22); // This assert triggers, not the others.
}
--
Simen
More information about the Digitalmars-d-learn
mailing list