← Back to index
|
Original Bugzilla link
Bug 9035 – Nested struct `init` is lvalue and can be modified
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-11-16T04:56:00Z
Last change time
2012-12-04T18:29:32Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
verylonglogin.reg
Blocks
9036
Comments
Comment #0
by verylonglogin.reg — 2012-11-16T04:56:27Z
--- struct S { } void f(T)(auto ref T t) { static assert(!__traits(isRef, t)); } void main() { f(S.init); // ok, rvalue f(S()); // ok, rvalue int i; struct Nested { int j = 0; void f() { ++i; } } f(Nested()); // ok, rvalue f(Nested.init); // fails, lvalue assert(Nested.init.j == 0); (ref n) { n.j = 5; }(Nested.init); assert(Nested.init.j == 0); // fails, j is 5 } ---
Comment #1
by k.hara.pg — 2012-11-18T21:48:41Z
https://github.com/D-Programming-Language/dmd/pull/1301
Comment #2
by github-bugzilla — 2012-12-03T20:58:34Z
Commits pushed to master at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/a5514dd6ed97646abe3d0f32631d22ef42f58f99
fix Issue 9035 - Nested struct `init` is lvalue and can be modified
https://github.com/D-Programming-Language/dmd/commit/3b061322300c5b7a39f1b5c5f76016a4d9906899
Merge pull request #1301 from 9rnsr/fix9035 Issue 9035 & 9036 - Nested struct `init` is lvalue and can be modified
Comment #3
by github-bugzilla — 2012-12-03T22:01:08Z
Commit pushed to master at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/acf8a8934dff6b9cdfcc4d5f98b9b5c242b11ebd
fixup for pull #1301 and #1309 By fixing bug 9069 and 9035, T.init always returns rvalue and ref cannot receive it.