[Issue 9700] New: std.typecons.Proxy with invaliant and in-place operation causes Access Violation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Mar 12 06:21:27 PDT 2013
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 at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at 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: -------
More information about the Digitalmars-d-bugs
mailing list