[Issue 7841] New: Better error message for wrong template argument with ref

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 5 18:09:11 PDT 2012


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 at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-04-05 18:09:49 PDT ---
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: -------


More information about the Digitalmars-d-bugs mailing list