[Issue 7355] inout incorrectly resolved if the same type has both mutable and immutable parts

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 26 04:30:42 PST 2012


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



--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2012-01-26 04:30:30 PST ---
My understanding is, each inout deduction from a function argument just like
pattern matching.

Parameter type:   inout(          int *)*
 Argument type: mutable(immutable(int)*)*  // mutable(...) is pseudo modifier
--> 'inout' is deduced to 'mutable'.

I think if we allow this kind of deduction, there is an ambiguous case:

inout(int) foo(inout(int**) x){ return 0; }
void main()
{
    immutable(int*)* x;
    foo(x);
    // inout is deduced to imuutable or const? Both conversions
    //  immutable(int*)* to immutable(int**)
    //  immutable(int*)* to     const(int**)
    // are valid, so it is ambiguous.
}

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