A variable-argument function works at runtime, but doesn't compile as a mixin: mixin (declareAllFeatures ("a", "b", "c")); string declareAllFeatures (T...)(T features) { string [] arr = []; foreach (f; features) { arr ~= f; } return declareAllFeaturesArr (arr); } string declareAllFeaturesArr (string [] allFeatures) { return "int x;"; }
The order of declarations seems to matter, so here's the modified example and the error message: string declareAllFeaturesArr (string [] allFeatures) { return "int x;"; } string declareAllFeatures (T...)(T features) { string [] arr = []; foreach (f; features) { arr ~= f; } return declareAllFeaturesArr (arr); } mixin (declareAllFeatures ("a", "b", "c")); Error: cannot evaluate declareAllFeatures(&"a",&"b",&"c") at compile time
This was fixed before 2.022.