digitalmars.D.bugs - [Issue 438] New: Compiler allows returning value from void function
- d-bugmail puremagic.com (27/27) Oct 17 2006 http://d.puremagic.com/issues/show_bug.cgi?id=438
- d-bugmail puremagic.com (10/10) Oct 17 2006 http://d.puremagic.com/issues/show_bug.cgi?id=438
- Brad Roberts (5/6) Oct 17 2006 Can you point to where this is documented in the language spec and maybe...
- Sean Kelly (3/8) Oct 18 2006 I can understand accepting "return void" from a void function, as in
http://d.puremagic.com/issues/show_bug.cgi?id=438 Summary: Compiler allows returning value from void function Product: D Version: 0.169 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P3 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: vlasov scatt.com The following code compiles without errors void foo() { return false; } void bar() { return "bar"; } void main() { foo(); bar(); } --
Oct 17 2006
http://d.puremagic.com/issues/show_bug.cgi?id=438 csantander619 gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID Not a bug, see http://www.digitalmars.com/d/changelog1.html#new0116 "Can now return an expression from a function returning void" --
Oct 17 2006
http://d.puremagic.com/issues/show_bug.cgi?id=438Can you point to where this is documented in the language spec and maybe some past threads discussing it? I'm really curious as to the reasons behind the choice. Thanks, Brad
Oct 17 2006
Brad Roberts wrote:> http://d.puremagic.com/issues/show_bug.cgi?id=438 Can you point to where this is documented in the language spec and maybe some past threads discussing it? I'm really curious as to the reasons behind the choice.I can understand accepting "return void" from a void function, as in C++, but I would expect returning anything else to generate a compile error.
Oct 18 2006