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


david <dav...@126.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




--- Comment #5 from david <dav...@126.com>  2009-07-03 07:56:21 PDT ---
(In reply to comment #3)
> const, yes, but not immutable as that would require that mutable be implicitly
> convertible to immutable, which cannot be.

It's not implicit cast. But a special case for function/delegate parameters.

Any qualifier for parameters or for the function is a restriction for the
function. So you can still treat them as a special case of mutable version just
they don't change anything even they are allowed to change the parameter.


This is another testcase. 
void foo(void delegate(void[]) dg);

void test()
{
    void func(invariant(void)[] t)
    {
    }

    foo(&func);
}

test.func won't change paramter t. So this func as a delegate is perfectly safe
to hold the prototype which has no restrictions on parameters.

It's not casting invariant(void)[] to void[]. It's implicitly casting from
"void delegate(invariant(void)[])" to "void delegate(void[])".

Furthermore, it's pretty ugly to write:
void foo(void delegate(void[]) dg);

void test()
{
    void func(invariant(void)[] t)
    {
    }

    foo(cast(void delegate(void[]))&func);
}

I don't think it is an invalid bug. But you can mark it as WONTFIX.

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

Reply via email to