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

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-12T06:21:00Z
Last change time
2013-03-13T01:29:06Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2013-03-12T06:21:26Z
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 }
Comment #1 by k.hara.pg — 2013-03-12T23:21:41Z
Comment #2 by github-bugzilla — 2013-03-13T00:40:56Z
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