Using SetFunctionAttributes on a D-style varadic function with at least one non-variadic parameter causes it to turn the last non-variadic parameter into a typesafe varadic parameter:
import std.traits;
void fn(int a, ...){}
alias Fn = typeof(fn);
//this should be exactly the same as `Fn`, right?
alias Fn2 = SetFunctionAttributes!(Fn, "D", functionAttributes!Fn);
//NOPE! Because it has actually been turned into a typesafe varadic function!
static assert(is(Fn2 == typeof(*void function(int...))));
This is because the mixin generator inside SetFunctionAttributes just appends "..." when it detects D-style variadic linkage, which fails to account for functions with multiple parameters.
Using
SetFunctionAttributeson a D-style varadic function with at least one non-variadic parameter causes it to turn the last non-variadic parameter into a typesafe varadic parameter:This is because the mixin generator inside
SetFunctionAttributesjust appends"..."when it detects D-style variadic linkage, which fails to account for functions with multiple parameters.