clear() causes crash?

Mafi mafi at example.org
Tue Apr 30 12:47:43 PDT 2013


On Monday, 29 April 2013 at 21:04:30 UTC, Luís Marques wrote:
> This crashes in the last line of main:
>
>     class A
>     {
>         void foo() {}
>     }
>
>     void main()
>     {
>         A a = new A();
>         a.foo();
>         clear(a);
>         assert(a !is null);
>         a.foo();  // crashes
>     }
>
> As far as I understand from TDPL book, this should not crash, 
> but it does (DMD64 v2.062, OS X). Am I misunderstanding clear()?
>
> BTW, why not make clear also change 'a' to null?

Hasn't 'clear' been renamed to 'destroy'?


More information about the Digitalmars-d mailing list