http://d.puremagic.com/issues/show_bug.cgi?id=4027
Summary: Nested function's bug in CTFE Product: D Version: 2.041 Platform: x86 URL: http://dusers.dip.jp/modules/forum/index.php?topic_id= 59#post_id222 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: zan77...@nifty.com --- Comment #0 from SHOO <zan77...@nifty.com> 2010-03-29 14:19:25 PDT --- (This bug was posted to the Japanese community site. I translate this report.) This code doesn't work! ------------------------------------------- auto f(string s) { return { return s; }; } void main() { static immutable s = f("aaa")(); static assert(s == "aaa");// Error: static assert (null == "aaa") is false } ------------------------------------------- The function fails regardless of the argument when execute the following codes in CTFE: ------------------------------------------- auto f(string s) { return { assert(s); }; } ------------------------------------------- You can take the following measures to avoid this problem: ------------------------------------------- auto f(string s) { auto _s = s; return { assert(_s); }; } ------------------------------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------