www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10728] New: A combination of implicit conversion and lambda call cannot be compiled

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

           Summary: A combination of implicit conversion and lambda call
                    cannot be compiled
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: ttanjo gmail.com


--- Comment #0 from Tomoya Tanjo <ttanjo gmail.com> 2013-07-29 10:10:32 PDT ---
In the following code, function foo cannot be compiled but it should.

--- foo.d
string foo(char[] s) // It cannot be compiled
{
    return s ? (){ return s[0..$].dup; }() : null;
}

string bar(char[] s) // It can be compiled
{
    return s ? s[0..$].dup : null;
}
---

Output:
$ dmd -main -run foo.d
foo.d(3): Error: cannot implicitly convert expression (s ? delegate char[]()
{
return _adDupT(& _D11TypeInfo_Aa6__initZ, s[0LU..__dollar]);
}
() : null) of type char[] to string

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 29 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10728



--- Comment #1 from Tomoya Tanjo <ttanjo gmail.com> 2013-07-29 10:12:57 PDT ---
It is reproduced by dmd v2.064-devel-f1c47fb on Linux 64bit.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 29 2013