www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7841] New: Better error message for wrong template argument with ref

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

           Summary: Better error message for wrong template argument with
                    ref
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This is correct D2 code, and it gives no error messages:

void foo(T)(const ref T[] a) {}
void bar(in int[] b) {
    foo(b);
}
void main() {}



This is wrong D2 code (I have replaced "const ref" with "ref"):


void foo(T)(ref T[] a) {}
void bar(in int[] b) {
    foo(b);
}
void main() {}


DMD 2.059 gives this error message:

temp.d(1): Error: template temp.foo(T) cannot deduce template function from
argument types !()(const(int[]))

In this case I'd like a better error message.

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