www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19057] New: 2.079 changelog variadic template and default

https://issues.dlang.org/show_bug.cgi?id=19057

          Issue ID: 19057
           Summary: 2.079 changelog variadic template and default
                    arguments
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dlang.org
          Assignee: nobody puremagic.com
          Reporter: johanengelen weka.io

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

--
Jul 04 2018