Error: expression 1 + 2 is not a valid template value argument ---------- void a(int b = 1+2)(){}; void main() { a!(1+2)(); // OK a(); // fails }
workround: "a!()()" instead of "a()" Added to DStress as http://dstress.kuehne.cn/run/t/template_58_A.d http://dstress.kuehne.cn/run/t/template_58_B.d http://dstress.kuehne.cn/run/t/template_58_C.d http://dstress.kuehne.cn/run/t/template_58_D.d http://dstress.kuehne.cn/run/t/template_58_E.d
This has already been fixed in D2. Here's the patch for D1.046. It's trivial. Index: template.c =================================================================== --- template.c (revision 192) +++ template.c (working copy) @@ -3951,6 +3951,7 @@ { sinteger_t v; real_t r; + ea = ea->optimize(WANTvalue | WANTinterpret); if (ea->op == TOKvar) { sa = ((VarExp *)ea)->var;
Fixed DMD1.050.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル