[Issue 2778] New: alias this + IFTI doesn't work.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 1 10:03:33 PDT 2009


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

           Summary: alias this + IFTI doesn't work.
           Product: D
           Version: 2.027
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: dsimcha at yahoo.com


DMD 2.027 can't implicitly instantiate templates properly based on implicit
conversions via alias this.

import std.stdio;

struct ArrayWrapper(T) {
    T[] data;
    alias data this;
}

void doStuffTempl(T)(T[] data) {}

void doStuffFunc(int[] data) {}

void main() {
    ArrayWrapper!(int) foo;
    doStuffFunc(foo);  // Works.
    doStuffTempl!(int)(foo);  // Works.

    // Error: template test.doStuffTempl(T) does not match any function
    // template declaration
    // Error: template test.doStuffTempl(T) cannot deduce
    // template function from argument types !()(ArrayWrapper!(int))
    doStuffTempl(foo);
}


-- 



More information about the Digitalmars-d-bugs mailing list