enforce (i > 0) for i = int.min does not throw
Ali Çehreli
acehreli at yahoo.com
Sat Jan 27 14:49:52 UTC 2018
On 01/27/2018 06:13 AM, kdevel wrote:
> I would expect this code
>
> enforce3.d
> ---
> import std.exception;
>
> void main ()
> {
> int i = int.min;
> enforce (i > 0);
> }
> ---
>
> to throw an "Enforcement failed" exception, but it doesn't:
>
> $ dmd enforce3.d
> $ ./enforce3
> [nothing]
>
>
Looks like a major issue to me.
But enforce is a red herring there. This prints true with 2.078 as well:
import std.stdio;
void main ()
{
int i = int.min;
writeln(i > 0); // prints 'true' with 2.078
}
Ali
More information about the Digitalmars-d-learn
mailing list