The following code should not compile --- void foo(T : Object = INVALID)(T t) { } void main() { foo(null); } --- because INVALID does not give a valid symbol, although it is not used in the call.
TemplateValueParameter too: --- void foo(ubyte u = 0xFF1)() { } void main() { foo!1(); } ---
I'm not sure that's an issue. In trivial cases like this the code is obviously wrong, but the only way we're going to realistically catch all these is by always instantiating the template with default parameters, which is 1) not always possible, 2) a waste of compilation time.
I agree about the waste of time but keep the issue opened, just to be clear on the fact that the problem is already known.
other example: struct Foo { Foo opBinary(string op="-")(Foo f) { return Foo(); } } void main() { auto Foo = Foo() + Foo(); }
*** Issue 8844 has been marked as a duplicate of this issue. ***
*** This issue has been marked as a duplicate of issue 22540 ***