The following code fails to compile with error, "cannot evaluate generate() at compile time." This error is stopped by declaring x in global scope. void main() { int x; const string text = Gen!(x).generate(); } template Gen(alias A) { string generate() { return null; } }
Changed version, since this applied to D1.x as well. Still not fixed in D1.031. For phobos2, the code now needs to use 'enum' instead of const to trigger the behaviour: --- void main() { int x; enum string text = Gen!(x).generate(); } template Gen(alias A) { string generate() { return null; } }
Fixed dmd 1.047 and 2.032
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル