Some testing?
Jonathan M Davis
jmdavisprog at gmail.com
Wed Jul 14 12:07:31 PDT 2010
On Wednesday, July 14, 2010 11:55:57 bearophile wrote:
> This small D2 program compiles with no errors:
>
> T foo(T)(T x) {}
> void main() {}
>
> But there is no way it can compile, regardless of the type T, because
> foo()() lacks a return statement. So is it possible for the D compiler to
> perform some sanity tests for the template functions too, to catch a bugs
> like this one?
>
> Bye,
> bearophile
You get an error if you use foo. My guess would be that foo effectively doesn't
exist until you instantiate it, so there's not really a function to give you an
error on.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list