digitalmars.D.bugs - [Issue 6164] New: [CTFE] Local arrays in a recursive local function behave funny
- d-bugmail puremagic.com (38/38) Jun 16 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6164
- d-bugmail puremagic.com (10/10) Jun 16 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6164
- d-bugmail puremagic.com (13/13) Jun 23 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6164
http://d.puremagic.com/issues/show_bug.cgi?id=6164 Summary: [CTFE] Local arrays in a recursive local function behave funny Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: timon.gehr gmx.ch --- Comment #0 from timon.gehr gmx.ch 2011-06-16 12:40:49 PDT --- This is tt.d: import std.stdio; string ctfe(){ int[] ctfe2(int n){ int[] r=[]; if(n!=0) r~=[1]~ctfe2(n-1); return r; } return ctfe2(2).length == 2 ? "hello from runtime!" : "hello from compile time!"; } void main(){ pragma(msg,ctfe()); writeln(ctfe()); } $ dmd -run tt; hello from compile time! hello from runtime! $ The ctfe'd result is generally longer than the correct one. The example works as expected if ctfe2 is moved outside ctfe. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 16 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6164 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kennytm gmail.com --- Comment #1 from kennytm gmail.com 2011-06-16 13:07:12 PDT --- A workaround is to make ctfe2 a 'static function'. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 16 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6164 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug yahoo.com.au Resolution| |FIXED --- Comment #2 from Don <clugdbug yahoo.com.au> 2011-06-23 00:35:50 PDT --- https://github.com/D-Programming-Language/dmd/commit/1ebe10d6796db6acf62b456d6f908391ec4daad5 (subsequently reverted, and then recommitted). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 23 2011