http://d.puremagic.com/issues/show_bug.cgi?id=5399


bearophile_h...@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


--- Comment #1 from bearophile_h...@eml.cc 2011-01-01 23:00:02 PST ---
This isn't a bug, I was wrong. D2 specs clearly show this is working as
expected:
http://www.digitalmars.com/d/2.0/statement.html

ReturnStatement:
    return;
    return Expression ;

Expression is allowed even if the function specifies a void return type. The
Expression will be evaluated, but nothing will be returned. If the Expression
has no side effects, and the return type is void, then it is illegal.


Indeed, this too compiles:

void main() {
    int x;
    return x++;
}


But this is a potentially dangerous corner case in the return rules.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to