January 06, 2012 [Issue 3922] Refuse returning nonvoid from void functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=3922 timon.gehr@gmx.ch changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |timon.gehr@gmx.ch --- Comment #10 from timon.gehr@gmx.ch 2012-01-05 16:40:47 PST --- This is required for forwarding and cannot change. auto foo(T...)(T args){return bar(args);} -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 06, 2012 [Issue 3922] Refuse returning nonvoid from void functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=3922 --- Comment #11 from bearophile_hugs@eml.cc 2012-01-05 16:54:55 PST --- (In reply to comment #10) > This is required for forwarding and cannot change. > > auto foo(T...)(T args){return bar(args);} Thank you for your answer. If you are right and it can't change, then this issue should be closed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 06, 2012 [Issue 3922] Refuse returning nonvoid from void functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=3922 --- Comment #12 from Trass3r <mrmocool@gmx.de> 2012-01-06 04:59:49 PST --- (In reply to comment #10) > This is required for forwarding and cannot change. > > auto foo(T...)(T args){return bar(args);} Well couldn't this special case be checked? Accidentally turning the return type into void or forgetting to change the type from void after you added a return x; is much more common than such code imho. Also should a function returning something or not really depend on argument types? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 06, 2012 [Issue 3922] Refuse returning nonvoid from void functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=3922 --- Comment #13 from timon.gehr@gmx.ch 2012-01-06 06:28:39 PST --- (In reply to comment #12) > (In reply to comment #10) > > This is required for forwarding and cannot change. > > > > auto foo(T...)(T args){return bar(args);} > > Well couldn't this special case be checked? > Accidentally turning the return type into void Who on earth accidentally changes a function's return type? Also, if the function does not actually return void, a compile error results. > or forgetting to change the type > from void after you added a return x; is much more common than such code imho. That will give a compile error already. (unless x is a property function returning void) > Also should a function returning something or not really depend on argument types? You realize that it is already disallowed to return non-void from a function returning void? The only case that is allowed and should stay allowed is something like this: void bar(){...} void foo(){return bar();} -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 19, 2012 [Issue 3922] Refuse returning nonvoid from void functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=3922 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED CC| |yebblies@gmail.com Resolution| |FIXED --- Comment #14 from yebblies <yebblies@gmail.com> 2012-01-19 13:44:18 EST --- As far as I can tell, this bug has been fixed with issue 3746 and issue 5399. Returning a value from a void function is only allowed when the value evaluates to void, preventing the value from being lost accidentally. -- 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