http://d.puremagic.com/issues/show_bug.cgi?id=7355
--- Comment #4 from timon.g...@gmx.ch 2012-01-26 09:20:32 PST --- (In reply to comment #1) > 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'. > The compiler deduces inout to _immutable_ in this case. Other than that, it does not make much sense to talk about a mutable pseudo modifier: inout is transitive, but such a pseudo modifier cannot be transitive. > 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. > } The same ambiguity is already resolved at other points in the compiler: inout(int) foo(inout(int) x, inout(int)* y){ return 0; } void main(){ immutable(int)* y; foo(1, y); } inout is resolved to const, even though immutable would be a far better choice. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------