[Issue 12510] Templated overload ignored

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 3 01:36:27 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12510


Kenji Hara <k.hara.pg at gmail.com> changed:

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


--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> 2014-04-03 01:36:24 PDT ---
(In reply to comment #1)
> I think this might be the result of bug 1528. Not sure, but I think the empty
> template arguments are matched with MATCHexact, just like a plain function
> declaration. And subsequently converting both function arguments to const is
> deemed a better match than the template.
> 
> You can use this instead.
> 
> bool foo (const C lhs, const C rhs)
> {
>     foo!(C, C)(cast()lhs, cast()rhs);
> }

Yes, this is correct result caused by fixing issue 1528.
Another way is to supply "specialized foo" for const C parameters, like as:

bool foo(T:Object, U:Object)(const T lhs, const U rhs)
{
    return foo(cast()lhs, cast()rhs);
}

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


More information about the Digitalmars-d-bugs mailing list