__dtor vs __xdtor
HyperParrow via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Aug 11 10:20:18 PDT 2017
On Friday, 11 August 2017 at 17:12:22 UTC, bitwise wrote:
> On Friday, 11 August 2017 at 17:06:40 UTC, HyperParrow wrote:
> [...]
>> int i;
>> struct Foo
>> {
>> template ToMix(){ ~this(){++++i;}}
>> ~this(){++i;}
>> mixin ToMix;
>> }
>>
>> void main()
>> {
>> Foo* foo = new Foo;
>> foo.__xdtor;
>> assert(i==3);
>> Foo* other = new Foo;
>> foo.__dtor;
>> assert(i==4); // and not 6 ;)
>> }
>> =================
>
> I think you mean assert(i == 1) for the second one, right?
I made a mistake but it's not about i, which is a global.
I meant "other.__dtor." just before the last assert.
This doesn't change the results.
More information about the Digitalmars-d-learn
mailing list