[Issue 10574] "auto ref" fails to match when IFTI succeeds (strip to level const)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 11 07:17:59 PDT 2013


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



--- Comment #5 from Steven Schveighoffer <schveiguy at yahoo.com> 2013-07-11 07:17:57 PDT ---
(In reply to comment #3)

> That's exactly the current compiler's behavior. "auto ref"  always behave as
> "ref" parameter against lvalue argument `i`, then T[] cannot deduce type T from
> immutable(int[]).

To the user, auto ref should really mean "use ref if possible, otherwise do
not"

In other words, I think auto ref should be the equivalent of having two
identical templates, one with ref, and one without.  Because IFTI can do some
implicit casting, and implicit casting changes lvalues to rvalues, I think the
rule is incorrect.

The algorithm should be:

If lvalue, then try ref.  If that does not work, try non-ref version.  If that
does not work, error.

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