[Issue 9555] Type deduction for new lambda syntax literals breaks with templates

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 21 04:29:04 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9555


Maxim Fomin <maxim at maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |maxim at maxim-fomin.ru
         Resolution|                            |INVALID


--- Comment #1 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-02-21 04:29:03 PST ---
Actually type of lambda was not deduced to void, void here is pseudo type of
non-instantiated template, because a => a > 2 is a lambda template. If you
append type of a parameter, this would work, for ex:

import std.functional;

void main()
{
    auto deleg = toDelegate( (int a) => a > 2);
}

Since there is no guesses what type of "a" can be in the original code,
template cannot be instantiated. 

By the way, idea mentioned in forum discussion that there is problem with new
(lambda) syntax is also wrong, because the code can be rewritten with delegate
template:

import std.functional;

void main()
{
    auto deleg = toDelegate( delegate (a) { return a > 2; } );
}

with the same problem and same error message.

Close this as invalid.

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