[Issue 5123] Cannot assign null to a class with 'alias this'

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 26 13:44:02 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5123


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #1 from bearophile_hugs at eml.cc 2010-10-26 13:43:16 PDT ---
Here alias this is doing its work of "let's pretend" a Bar instance is a Foo
instance. To solve this problem you may need something more refined than alias
this, something that allows a partial aliasing. I don't think it's an easy
thing to do.

A related program shows a different outcome:

struct Foo {}
class Bar {
    Foo foo_;
    alias foo_ this;
}
void main() {
    Bar a;
    //a = null;
    Foo f;
    a = f; // Access violation!
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list