https://issues.dlang.org/show_bug.cgi?id=14421
--- Comment #5 from yebblies <[email protected]> --- (In reply to John Colvin from comment #4) > (In reply to yebblies from comment #3) > > Is there a reason you can't overload and forward the variadic version to the > > non-variadic after calling dup? > > I don't understand how that would help. > > What I'm concerned about is if making the variadic array argument creates a > GC allocation, then the .dup makes another one. If you have this: char[] foo(char[] args...) { return foo(args.dup); } char[] foo(char[] args) { return args; } void main() { foo('a', 'b', 'c'); // this will call first overload, and dup foo(['a', 'b', 'c']); // this will call second, no dup } The array will only be copied if the variadic version is called. --
