digitalmars.D.bugs - [Issue 10842] New: auto return function not executed depending on how it's called
- d-bugmail puremagic.com (42/42) Aug 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10842
- d-bugmail puremagic.com (30/30) Aug 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10842
- d-bugmail puremagic.com (14/16) Aug 17 2013 In my case I want to make it work with arbitrary types, not just strings...
- d-bugmail puremagic.com (22/23) Aug 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10842
- d-bugmail puremagic.com (15/15) Sep 28 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10842
- d-bugmail puremagic.com (11/11) Oct 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10842
- d-bugmail puremagic.com (10/10) Oct 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10842
http://d.puremagic.com/issues/show_bug.cgi?id=10842 Summary: auto return function not executed depending on how it's called Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: critical Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: thelastmammoth gmail.com dmd -version=A -run main.d: prints nothing dmd -version=B -run main.d: prints ok ---- auto fail(){ import std.stdio; writeln("ok"); /+ //would be same with this: assert(0); //or this: import std.exception; throw new Exception("bad"); +/ return null; } string foo(){ version(A){ auto temp=fail(); return temp; } else return fail(); } void main(){ foo(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10842 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com 18:40:12 PDT --- Reduced: ----- auto ret1() { assert(0); // should throw, doesn't return null; } string test1() { return ret1(); } void main() { test1(); } ----- If you change the return to an explicit expression, e.g. `return ""`, then the assert is triggered. Also perhaps noteworthy is that in older releases the reduced code used to fail to compile, e.g. in 2.057: Error: e2ir: cannot cast ret1() of type typeof(null) to type string -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10842If you change the return to an explicit expression, e.g. `return ""`, then the assert is triggered.In my case I want to make it work with arbitrary types, not just strings, do you have a suggestion for this? ( I just posted a suggestion here: http://forum.dlang.org/thread/mailman.160.1376790770.1719.digitalmars-d-learn puremagic.com "how to get enclosing function as symbol ? (eg: __function__.stringof ==__FUNCTION__)" which would allow this among other things. ) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10842 19:09:05 PDT ---Reduced:Actually the bug is unrelated to auto, but instead related to typeof(null): ----- typeof(null) ret1() { assert(0); // not thrown return null; } string test1() { return ret1(); } void main() { test1(); } ----- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10842 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull Summary|auto return function not |Some integer casts wrongly |executed depending on how |remove side-effect of the |it's called |operand. https://github.com/D-Programming-Language/dmd/pull/2597 The problem is in CastExp::toElem, it sometimes remove the side effect of the cast operand. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 28 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10842 Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/7123433d77bde06769d9227df8f5b3814117b1e6 fix Issue 10842 - Some integer casts wrongly remove side-effect of the operand https://github.com/D-Programming-Language/dmd/commit/175c85bc5658aae266c061d2c3c42a0607325676 Issue 10842 - Some integer casts wrongly remove side-effect of the operand. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 08 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10842 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 08 2013