Return type inference on template

Andrea Fontana advmail at katamail.com
Tue Jul 10 07:14:27 PDT 2012


Simple template:

T test(T)() { return T.init; }

This code give error:

int myVar;
myVar = test();

Why? Can't compiler guess T == int?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20120710/4332ed1e/attachment.html>


More information about the Digitalmars-d-learn mailing list