www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9700] New: std.typecons.Proxy with invaliant and in-place operation causes Access Violation

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

           Summary: std.typecons.Proxy with invaliant and in-place
                    operation causes Access Violation
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg gmail.com> 2013-03-12 06:21:26 PDT ---
import std.typecons;
struct MyInt {
    int value;    
    invariant() { assert(value >= 0); }
    mixin Proxy!value;
}
void main() {
    MyInt a;
    a = 2;
    a *= 3;   // object.Error: Access Violation
}

Reduced test case:

mixin template Proxy(alias a) {
    //auto ref opOpAssign(string op, V)(V v) { return a += v; }  // NG
    auto ref opOpAssign(string op, V)(V v) { a += v; } // OK
}
struct MyInt {
    int value;
    invariant(){ assert(value >= 0); }
    mixin Proxy!value;
}
void main() {
    MyInt a = { 2 };
    a *= 3;   // object.Error: Access Violatio
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 12 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9700


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-03-12 23:21:41 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1742

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9700



--- Comment #2 from github-bugzilla puremagic.com 2013-03-13 00:40:56 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/18da33b4d303f1dd020576a6a671f91fd6b06c10
fix Issue 9700 - std.typecons.Proxy with invaliant and in-place operation
causes Access Violation

https://github.com/D-Programming-Language/dmd/commit/c2d76aff5adab71090abb1d180ce3c8bfc5e20fb
Merge pull request #1742 from 9rnsr/fix9700

Issue 9700 - std.typecons.Proxy with invaliant and in-place operation causes
Access Violation

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 13 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9700


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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