Thread overview | |||||
---|---|---|---|---|---|
|
April 29, 2011 [Issue 5907] New: CTFE: Ref assignments are noop at compile time | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5907 Summary: CTFE: Ref assignments are noop at compile time Product: D Version: unspecified Platform: Other OS/Version: Windows Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: andrej.mitrovich@gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-04-28 17:05:20 PDT --- auto ok() { int[2] result; foreach (index, ref sample; result) { result[index] = 1; } return result; } auto fail() { int[2] result; foreach (index, ref sample; result) { sample = 1; } return result; } float[2] ctfe_ok = ok(); float[2] ctfe_fail = fail(); void main() { assert(ok == [1, 1]); // ok assert(fail == [1, 1]); // ok assert(ctfe_ok == [1, 1]); assert(ctfe_fail == [1, 1]); // throws } Unfortunately they fail silently and then you have bugs in your code. I'm not sure but maybe this bug was reported already? (or a fix is scheduled for the next release?) I couldn't be sure so I'm reporting it just in case. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 29, 2011 [Issue 5907] CTFE: Ref assignments are noop at compile time | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=5907 --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-04-28 17:07:42 PDT --- Oh btw sorry about using float[2] instead of int[2] there. I was quickly converting some existing code. The bug is still there if ctfe_ok and ctfe_fail are typed as ints. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 06, 2011 [Issue 5907] CTFE: Ref assignments are noop at compile time | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=5907 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug@yahoo.com.au Resolution| |DUPLICATE --- Comment #2 from Don <clugdbug@yahoo.com.au> 2011-05-06 01:48:14 PDT --- dup of 1330, which is fixed. *** This issue has been marked as a duplicate of issue 1330 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation