//----
import core.exception;
void main()
in
{
assert(0); //Passes
}
body
{
int i = 0;
assert(i != 0); //Error
version (assert) throw new RangeError(); //Error too
}
//----
When run with "-unittest -release", then the "in" block is stripped out, but the asserts aren't. This is inconsistent. The "in" block should also remain.
Also, *Arguably*, I think the version (assert) blocks should be stripped though: These can contain any kind of code, which does *more* than just tests (it can set pointers to 0, log things, deep deconstruct stuff, you name it), which we probably *specifically* don't want to run, since we are in a "release unittest".
Comment #1 by code — 2014-01-05T14:37:00Z
The question then becomes: What should _not_ be stripped with -release in -unittest mode?
Comment #2 by code — 2014-01-05T14:40:02Z
Erm, sorry, I managed to get that statement precisely the wrong way around.
My point was that the question becomes what of the code affected by -release actually _should_ be stripped in -release -unittest mode if e.g. contracts are left in.