[Issue 10728] New: A combination of implicit conversion and lambda call cannot be compiled
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 29 10:10:33 PDT 2013
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 at puremagic.com
ReportedBy: ttanjo at gmail.com
--- Comment #0 from Tomoya Tanjo <ttanjo at 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: -------
More information about the Digitalmars-d-bugs
mailing list