Bug 444 – Inside a foreach with delegates, void return does not compile

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-10-20T00:55:00Z
Last change time
2014-02-15T13:19:32Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
kinaba

Comments

Comment #0 by kinaba — 2006-10-20T00:55:30Z
void main() { int nothing( int delegate(inout int) dg ) {return 0;} foreach(int x; &nothing) return; } issues an error on dmd 0.172 (without line number info): cannot implicitly convert expression (0) of type int to void
Comment #1 by thomas-dloop — 2006-11-08T09:37:56Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-10-20: > http://d.puremagic.com/issues/show_bug.cgi?id=444 > void main() > { > int nothing( int delegate(inout int) dg ) {return 0;} > foreach(int x; &nothing) > return; > } > > issues an error on dmd 0.172 (without line number info): > cannot implicitly convert expression (0) of type int to void Added to DStress as http://dstress.kuehne.cn/compile/r/return_10_A.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFUgHLLK5blCcjpWoRAq8UAJ0YYx8jUri/zQNI5Q2jcH0XhTeXHQCfad+P yvXDTZcuqbqjrvv8XxVg7zg= =2aCD -----END PGP SIGNATURE-----
Comment #2 by bugzilla — 2006-11-25T03:53:58Z
Fixed DMD 0.175