www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5341] New: alias this ignores invariant()

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5341

           Summary: alias this ignores invariant()
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: simen.kjaras gmail.com


--- Comment #0 from Simen Kjaeraas <simen.kjaras gmail.com> 2010-12-10 05:17:58
PST ---
struct foo {
    int data;
    alias data this;
    invariant() {
        assert( data == 0 );
    }
}

void bar( ) {
    foo f;
    f = 4; // No assert
}

Not sure if this will ever be fixed, or even is supposed to, but I feel it is
worth adding here.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 10 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5341


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |INVALID


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2012-01-20
13:42:39 PST ---
Struct invariants are checked upon method entry and exit, they are not checked
when fields are modified otherwise.

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