Fighting with alias this: bugs or features?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Oct 26 16:17:03 PDT 2010


On 10/26/10 17:29 CDT, osa wrote:
> On 10/26/2010 05:09 PM, Andrei Alexandrescu wrote:
>> Thanks. Defining opAssign for Bar will allow you to use the syntax bar =
>> null and have it nullify the reference.
>
> I feel stupid, but I do not see how to nullify the Bar reference inside
> of opAssign. Again, my problem is that I have
> Bar x = new Bar( ... );
> and I want x to become null. Is there a workaround for 'cannot
> implicitly convert expression (null) of type void* to Foo' which does
> not involve low-level trickery like *cast(void**)&x = null?

Oh, I was confused. I thought you had the converse case - a class object 
inside a struct object. Compiler bug it is.

Andrei


More information about the Digitalmars-d mailing list