D1 and D2. Compile with -w. =========== void bar(real delegate(real) f) { } void foo() { return; assert(0); } void main() { bar( (real x){ return x; }); } =========== Output with DMD1.045: C:\dev>dmd -w bug warning - bug.d(5): Error: statement is not reachable bug.d(9): Error: function bug.bar (real delegate(real)) does not match parameter types (int delegate(real x)) bug.d(9): Error: cannot implicitly convert expression (__dgliteral1) of type int delegate(real x) to real delegate(real) On DMD2.030, the type is 'void' instead: C:\dev>dmd -w bug warning - bug.d(5): Error: statement is not reachable bug.d(9): Error: function bug.bar (real delegate(real) f) does not match paramet er types (void delegate(real x)) bug.d(9): Error: cannot implicitly convert expression (__dgliteral1) of type voi d delegate(real x) to real delegate(real)
I'm not sure if this is valid, only because DMD treats warnings as errors, and the code wouldn't compile anyway even if it didn't spit out the bogus subsequent error. I've had it spit out dumb semantic errors like this after other errors, and errors after the first are usually not to be trusted anyway.. It's kind of like how DMD sets the type of invalid expressions to 'int' and then marches on, giving you all sorts of dumb errors that don't actually mean anything.
>I'm not sure if this is valid, only because DMD treats warnings as errors, and the code wouldn't compile anyway even if it didn't spit out the bogus subsequent error. If it were in the same function, I would agree. But in this case, I can't see _any_ reason for the error to propagate from one function to an unrelated one. It's an indication that something's wrong.
Fixed in D1 in DMD1.046, and in D2, sometime before D2.035.