[Issue 6648] New: fix invariant

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 11 11:22:18 PDT 2011


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

           Summary: fix invariant
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: timon.gehr at gmx.ch


--- Comment #0 from timon.gehr at gmx.ch 2011-09-11 11:22:02 PDT ---
Consider:

struct S{
    int x=1;
    invariant(){assert(x==1);}
    void foo(){x=2;bar(1);}
    void bar(int i){x=i;}
}

void main(){
    S s;
    s.foo();
}

This should run fine, but currently it throws an AssertError.
Because of this, D's invariant is mostly useless outside toy examples.

-- 
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