www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7525] New: Broken return type inference for delegate returns

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7525

           Summary: Broken return type inference for delegate returns
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: siegelords_abode yahoo.com



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()

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 16 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7525




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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 22 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7525


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid
            Summary|Broken return type          |[2.058 regression] Broken
                   |inference for delegate      |return type inference for
                   |returns                     |delegate returns



https://github.com/D-Programming-Language/dmd/pull/765

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 26 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7525




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/53b1a0461b485c1260514094e2164bd749f3f6d0


[2.058 regression] Issue 7525 - Broken return type inference for delegate
returns

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 26 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7525


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 27 2012