why are types mismatch?
Maxim Fomin
maxim at maxim-fomin.ru
Tue Oct 1 12:20:16 PDT 2013
On Tuesday, 1 October 2013 at 19:11:26 UTC, Roman wrote:
> On Tuesday, 1 October 2013 at 18:46:45 UTC, deadalnix wrote:
>> On Tuesday, 1 October 2013 at 18:38:33 UTC, Roman wrote:
>>>> Can you paste the output of your code so we can help you
>>>> more easily ?
>>>
>>> int(int i) != int function(int)
>>> int function(int i) pure nothrow @safe != int function(int)
>>> 2
>>> 4
>>>
>>> So, why 1st case incorrect?
>>
>> The first case is a bug to me. Can you fill it in
>> http://d.puremagic.com/issues/ please ? The second is expected.
>>
>> What you should do is test via is(typeof(...)) :
>> function_type). The : test for implicit conversion, and int
>> function(int i) pure nothrow @safe convert implicitly to int
>> function(int) .
>
> With ":" bar!((int i)=> i*2)(2) works properly, but bar!foo(2)
> still doesn't pass expression ( evidently foo doesn't
> implicitly convert to function_type)
You are not in C, where 'function_name' (except some
circumstances) is implicitly converted to pointer to that
function.
More information about the Digitalmars-d
mailing list