Automatic invariant generation
Nemanja Boric via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 7 02:17:18 PDT 2017
On Friday, 7 July 2017 at 08:21:50 UTC, Nicholas Wilson wrote:
> The compiler seems to inset an `assert(this !is null, "null
> this");` into my struct.
> which is for all intents and purposes.
> struct Foo {
> Bar b;
> }
>
> struct Bar {
> void* ptr;
> }
>
> I tried disabling the invariant but it complained that
> invariant requires a function body.
> Is there a way to disable the implicit generations of
> invariants for my code other than -release? Like for a
> particular subset of files (separate invocations of the
> compiler is not an acceptable approach.
>
> The reason being that I do not support global variables (of any
> kind) at the moment in dcompute and the insertion of the string
> literal to the assert breaks that.
Related: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1006.md
More information about the Digitalmars-d
mailing list