[Issue 12290] New: IFTI should consider implicit conversions of the literal arguments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 3 00:15:27 PST 2014


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

           Summary: IFTI should consider implicit conversions of the
                    literal arguments
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2014-03-03 00:15:25 PST ---
Test case:

inout(V) get(K, V)(inout(V[K]) aa, K key, lazy inout(V) defaultValue)
{
    auto p = key in aa;
    return p ? *p : defaultValue;
}

void main()
{
    short[short] aa = [1:10, 2:20];

    short n = get(aa, 5, 50);
    // IFTI should deduce K=short, V=short from the arguments
    // !()(short[short], int, int)
    // because 1 and 2 are implicitly convertible to short
    // , and 10 and 20 are implicitly convertible to short

    assert(n == 50);
}

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