www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10592] New: Regression of overloaded template function

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10592

           Summary: Regression of overloaded template function
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: zan77137 nifty.com


--- Comment #0 from SHOO <zan77137 nifty.com> 2013-07-10 03:21:17 PDT ---
This code doesn't work in dmd git head master:
--------------
struct A(E)
{
    void put()(const(E)[] data)
    { pragma(msg, "hit 1"); }
    void put()(const(dchar)[] data) if (!is(E == dchar))
    { pragma(msg, "hit 2"); }
    void put(C)(const(C)[] data) if (!is(C == dchar) && !is(E == C))
    { pragma(msg, "hit 3"); }
}

void main()
{
    A!char x;
    x.put("abcde"c); // OK: hit 1
    x.put("abcde"w); // NG: this should hit 3
    x.put("abcde"d); // OK: hit 2
}
--------- RESULT -----------
$ dmd -run main
hit 1
hit 2
main.d(12): Error: template main.A!char.A.put does not match any function
templa
te declaration. Candidates are:
main.d(3):        main.A!char.A.put()(const(E)[] data)
main.d(4):        main.A!char.A.put()(const(dchar)[] data) if (!is(E == dchar))
main.d(5):        main.A!char.A.put(C)(const(C)[] data) if (!is(C == dchar) &&
!
is(E == C))
main.d(12): Error: template main.A!char.A.put()(const(E)[] data) cannot deduce
t
emplate function from argument types !()(immutable(wchar)[])

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 10 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10592


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-07-10 06:11:08 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2332

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 10 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10592


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

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


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