[Issue 3478] "no effect in expression" error on return to void
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 5 21:42:49 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3478
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clugdbug at yahoo.com.au
--- Comment #4 from Don <clugdbug at yahoo.com.au> 2009-11-05 21:42:48 PST ---
(In reply to comment #2)
> You should change the spec in this case:
>
> http://www.digitalmars.com/d/1.0/statement.html
>
>
> "Expression is allowed even if the function specifies a void return type. The
> Expression will be evaluated, but nothing will be returned."
It's still true. This works, for example:
void foo() {
return bar();
}
It's exactly the same as: { bar(); return; } which is OK.
Likewise, return 0; becomes { 0; return; } which is generating the "no effect"
error.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list