This worked in DMD 2.057, but doesn't compile in 2.058: void main() { int a; char[] delegate() b = { a = 0; return null;}; } Error is: test.d(4): Error: cannot implicitly convert expression (__lambda1) of type typeof(null) delegate() nothrow @safe to char[] delegate()
A few more examples that don't work in 2.058 but work in 2.057: int delegate() a = {return 1U;}; uint delegate() b = {return 1;}; float delegate() c = {return 1.0;}; double delegate() d = {return 1.0f;}; Note that both compilers allow implicit conversions between those basic type pairs.
https://github.com/D-Programming-Language/dmd/pull/765
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/53b1a0461b485c1260514094e2164bd749f3f6d0 Merge pull request #765 from 9rnsr/fix7525 [2.058 regression] Issue 7525 - Broken return type inference for delegate returns