digitalmars.D.bugs - [Issue 12883] New: implicit conversion of struct to mutable via
- via Digitalmars-d-bugs (37/37) Jun 09 2014 https://issues.dlang.org/show_bug.cgi?id=12883
https://issues.dlang.org/show_bug.cgi?id=12883 Issue ID: 12883 Summary: implicit conversion of struct to mutable via alias this Product: D Version: D2 Hardware: x86_64 OS: Linux Status: ASSIGNED Keywords: rejects-valid Severity: enhancement Priority: P1 Component: DMD Assignee: nilsbossung googlemail.com Reporter: nilsbossung googlemail.com --- static struct S { int x; void* dummy; property S mutable() const {return S(42);} alias mutable this; } void main() { const c = S(13); S m1 = c; assert(m1.x == 42); S m2; m2 = c; assert(m2.x == 42); static void f(S s) {assert(s.x == 42);} f(c); } --- Pull request is on the way. --
Jun 09 2014