[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 Feb 2 12:07:34 PST 2012


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



--- Comment #9 from Steven Schveighoffer <schveiguy at yahoo.com> 2012-02-02 12:07:29 PST ---
(In reply to comment #8)
> This rule should work satisfactory:
> 
> - The compiler is required to resolve inout such that the behavior is as if
> there were four (five, with inout(const(T)) enhancement in place) separate
> overloads. This could be implemented similar to how you propose it, by adding
> all of the versions to the overload set, or by using some insights to speed up
> the process (not very hard)

This sounds fine.  However, inout(const(T)) is not a substitute for inout(T),
so it should be four.

inout(const(T)) is special in what can implicitly convert to it.  But the inout
is the only wildcard there.

The rest is not necessary.  The normal overload rules already should handle
which one is chosen.  Since inout, mutable, and immutable do not implicitly
convert to each other, it's not possible for there to be an ambiguity, is
there?  immutable and mutable (and by extension inout) should be preferred over
const.

It's important to note that the inout overload we are talking about is not the
wildcard inout, but the local const-like inout.

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