[Issue 12734] New: Template cannot deduce E[] from typeof(null)
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun May 11 13:08:07 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12734
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 at puremagic.com
Reporter: andrej.mitrovich at 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.
--
More information about the Digitalmars-d-bugs
mailing list