Bug 2010 – Template tuples don't work in string mixins

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2008-04-18T18:02:00Z
Last change time
2015-06-09T01:14:38Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bartosz
Blocks
340

Comments

Comment #0 by bartosz — 2008-04-18T18:02:34Z
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;"; }
Comment #1 by bartosz — 2008-04-18T18:08:10Z
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
Comment #2 by clugdbug — 2009-09-23T05:25:00Z
This was fixed before 2.022.