https://dlang.org/phobos/std_exception.html#enforce states:

| Also, do not use enforce inside of contracts (i.e. inside of in and out blocks | and invariants), because they will be compiled out when compiling with -release.
| Use assert in contracts.

But assert is also ignored in release mode:

ass.d
---
void foo (int i)
in {
   assert (i < 0);
}
body {
}

void main ()
{
   foo (1);
}
---

$ dmd ass
$ ./ass
core.exception.AssertError@ass.d(3): Assertion failure
----------------
??:? _d_assertp [0x42a065]
??:? void ass.foo(int) [0x429f9d]
??:? _Dmain [0x429fad]

$ dmd -release ass
$ ./ass
[nothing]

Reply via email to