Bug 10595 – Using alias this and a hash generates wrong code

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-10T07:54:00Z
Last change time
2013-09-22T22:14:18Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2013-07-10T07:54:54Z
----- struct S { bool b = true; bool test() { if (!b) // note: must be a check, not 'return b;' return false; return true; } } struct Wrap { int i; alias i this; S s; } void main() { { Wrap[int] wrap; wrap[0] = Wrap(); wrap[0].i = 0; assert(wrap[0].s.test()); // ok } { Wrap[int] wrap; wrap[0] = Wrap(); wrap[0] = 0; // note: using 'alias this' to assign assert(wrap[0].s.test()); // failure } } ----- It doesn't appear to be a regression.
Comment #1 by k.hara.pg — 2013-09-22T10:42:55Z
Comment #2 by github-bugzilla — 2013-09-22T13:04:29Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0c965af287534093c0282480019b5d8749046357 fix Issue 10595 - Using alias this and a hash generates wrong code