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

           Summary: Struct const member makes struct const
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: taro...@gmail.com


--- Comment #0 from Tom <taro...@gmail.com> 2011-03-03 05:34:25 PST ---
int main(string[] args) {
    auto s1 = f(); // MH MH
    auto s2 = g(); // OK
    s2.c = null; // OK
    return 0;
}

class C {}

struct StructWithConstMember {
    this(int i, C c) { this.i=i; this.c=c; }
    int i;
    const(C) c;
}

struct StructWithoutConstMember {
    this(int i, C c) { this.i=i; this.c=c; }
    int i;
    C c;
}

ref StructWithConstMember f() {
    return * new StructWithConstMember(1, new C); // ERROR
}

ref StructWithoutConstMember g() {
    return * new StructWithoutConstMember(1, new C); // OK
}


src\main.d(27): Error: *new StructWithConstMember(1,new C) is not mutable

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

Reply via email to