On 10/26/2010 03:22 PM, "Jérôme M. Berger" wrote:
        I'm not sure that the problem is on the line where the error is
reported. My guess would be that the issue is with the "auto a = new
Bar" line: I would bet that this gets interpreted as "Foo a = new
Bar" instead of what we expect ("Bar a = new Bar"). If I'm right,
then the "a = null" line is indeed an error: since Foo is a struct
and structs are value types, you cannot affect "null" to a variable
of type Foo...

No, that's not the case. Here is an updated test case, without any auto's:
-----
struct Foo {}
class Bar {
    Foo foo_;
    alias foo_ this;
}
void main() {
    Bar a;
    a = null;
}
------
aliasthis1.d(8): Error: cannot implicitly convert expression (null) of type void* to Foo

So it seems to be a real problem. I've reported it in Bugzilla:
http://d.puremagic.com/issues/show_bug.cgi?id=5123

Reply via email to