[Issue 3746] Misleading error message "OP has no effect in expression XXX), in void function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 14 05:23:51 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3746
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clugdbug at yahoo.com.au
--- Comment #12 from Don <clugdbug at yahoo.com.au> 2011-06-14 05:19:10 PDT ---
(In reply to comment #10)
> (In reply to comment #9)
> >
> > I don't understand. Elsewhere I have a bug report that asks for a new error
> > message if you don't use the result of a pure function.
> > But this bug report just asks for a better error message in the situation of
> > using "return x;" in a void function. So I expected an error message like:
> >
> > foo.d(20): Error: a void function can't return 'int'.
>
> Returning an int expression from a void function is perfectly legal, so long as
> the expression has side effects. This is explicitly allowed by the spec.
> http://www.digitalmars.com/d/2.0/statement.html#ReturnStatement
Yes, but it was agreed on the newsgroup that this is a misfeature. (Andrei was
horrified about it). It should be disallowed.
--
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