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



--- Comment #13 from Kenji Hara <k.hara...@gmail.com> 2012-09-21 20:19:53 PDT 
---
(In reply to comment #12)
> For structs, as long as there is no static opCall declared, S() and S.init
> should be identical, 

This is not already true for nested structs.

void main() {
    int g = 10;
    struct S {
        int n;
        auto foo(){ return g; }
    }
    auto s1 = S();  // StructLiteralExp
    assert(s1.tupleof[$-1] !is null);  // hidden ptr is filled
    assert(s1.foo() == 10);            // OK
    auto s2 = S.init;
    assert(s2.tupleof[$-1]  is null);  // hidden ptr isn't filled
    assert(s2.foo() == 10);            // Access Violation!
}

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

Reply via email to