[Issue 14108] template object.get cannot deduce function from argument types

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Feb 1 17:59:45 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14108

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Timothee Cour from comment #0)
> Not sure if it's related to 1370 but it still appears in git head
> (v2.067-devel-e542e14)

OT: I'm not sure what the "1370" is.

> 
> ----
> enum b=[
>   "a":1,
> ];
> void main(){
>   char[]a="a".dup;

    b.get(a,1);      // error in git head
    b.get(a.idup,1); // no error in git-head

The error is in `b.get(a,1);`.

> }
> ----
> dmd -run main.d
> Error: template object.get cannot deduce function from argument types
> !()(int[string], char[], int), candidates are:...
> 
> it worked in dmd 2.066 (v2.066-devel-4d3a95a)

The type of b is int[string]. To access the AA, you have to use a key typed as
`string`. Therefore using `a` typed char[] to access AA should be type mismatch
error.

Honestly, dmd 2.066 has an IFTI regression that was not properly fixed. The
line b.get(a,1); has been correctly rejected until 2.065. So, it was an
"accepts-invalid bug only in 2.066 release.

--


More information about the Digitalmars-d-bugs mailing list