← Back to index
|
Original Bugzilla link
Bug 1975 – void func return value not checked
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2008-04-05T15:54:00Z
Last change time
2015-06-09T01:14:36Z
Assigned to
bugzilla
Creator
someanon
Comments
Comment #0
by someanon — 2008-04-05T15:54:46Z
should raise a warning/ or error: $ cat voidreturn.d void f() { return 1; } $ dmd -c -w voidreturn.d
Comment #1
by matti.niemenmaa+dbugzilla — 2008-04-06T04:12:30Z
This is quite intentional.
http://digitalmars.com/d/2.0/statement.html#ReturnStatement
says: "Expression is allowed even if the function specifies a void return type. The Expression will be evaluated, but nothing will be returned."