Some testing?
Mafi
mafi at example.org
Wed Jul 14 12:12:06 PDT 2010
Am 14.07.2010 20:55, schrieb bearophile:
> 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?
Imagine T was void. Then no return was ok. It wouldn't (shouldn't)
compile anyways because a parameter of type void is (should be) invalid.
However to enforce the compiler to see that T can't be void is a bit to
complicated, I think.
Mafi
More information about the Digitalmars-d-learn
mailing list