http://d.puremagic.com/issues/show_bug.cgi?id=5117
Summary: [CTFE] Member function call with chained dots: side effects ignored Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: rsi...@gmail.com --- Comment #0 from Shin Fujishiro <rsi...@gmail.com> 2010-10-25 09:09:49 PDT --- The interpretor neglects member functions mutating 'this' if a function call involves two or more chained dot expressions. In the following repro, s.change() succeeds in mutating 'this' but r.s.change() does not: -------------------- static int dummy = test(); int test() { S s; s.change(); assert(s.value == 1); // (7) succeeds R r; r.s.change(); assert(r.s.value == 1); // (11) fails, value == 0 return 0; } struct S { int value; void change() { value = 1; } } struct R { S s; } -------------------- % dmd -o- -c test.d test.d(11): Error: assert(r.s.value == 1) failed test.d(1): Error: cannot evaluate test() at compile time test.d(1): Error: cannot evaluate test() at compile time -------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------