Bug 7525 – [2.058 regression] Broken return type inference for delegate returns

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-02-16T14:33:00Z
Last change time
2012-02-27T10:52:23Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
siegelords_abode

Comments

Comment #0 by siegelords_abode — 2012-02-16T14:33:26Z
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()
Comment #1 by siegelords_abode — 2012-02-22T13:59:01Z
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.
Comment #2 by k.hara.pg — 2012-02-26T02:29:00Z
Comment #3 by github-bugzilla — 2012-02-26T21:37:19Z
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