www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12734] New: Template cannot deduce E[] from typeof(null)


          Issue ID: 12734
           Summary: Template cannot deduce E[] from typeof(null)
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: andrej.mitrovich gmail.com

void take1(int[] buffer) { }
void take2(E)(E[] buffer) { }

void main()
    take1(null);  // ok
    take2(null);  // fail

I'm not sure what 'E' would be deduced to with a typeof(null) though. Maybe
just a 'void'? Or a 'void*'? It's hard to tell, but the above forces us to
create overloads for the sake of supporting null.

May 11 2014