| |
 | Posted by Johan Engelen | Permalink Reply |
|
Johan Engelen 
| The changelog of 2.079 says:
"
3. Function parameters with default values are now allowed after variadic template parameters
Function parameters with default values are now allowed after variadic template parameters and when IFTI is used, always take their default values.
...
"
However, parameters with default values were already allowed after variadic template parameters. And the 2.079-change of behavior results in compile errors (in the best case), but may also lead to bad runtime behavior of previously working code. I hope the change was made knowingly that it was a semantic change, instead of an addition to the semantics...
Simple test case:
```
import std.stdio;
void bar(Args...)(Args _args, int timeout = 0) {
pragma(msg, typeof(_args));
writeln(_args, timeout);
}
void main() {
bar("a", "b", 2); // used to print "ab2", but since 2.079 prints "ab20"
}
```
Semantic changes like this need to be very clearly marked in the changelog. Updating the compiler on a commercial codebase is already enough of an adventure, no need to add extra uncertainties.
Please fix the changelog.
Thanks,
Johan
|