Automatic invariant generation
Stefan Koch via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 7 06:38:13 PDT 2017
On Friday, 7 July 2017 at 13:34:20 UTC, Steven Schveighoffer
wrote:
> On 7/7/17 4:21 AM, 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;
>> }
>
> What? When is this invariant called? I've never heard of a
> hidden invariant being added to structs, structs are supposed
> to be free of such things.
>
> I would call such a thing a bug.
>
> -Steve
It was added because someone VIP demanded it I guess.
you can see the assert being added using -vcg-ast ;)
More information about the Digitalmars-d
mailing list