This is tt.d: import std.stdio; string ctfe(){ int[] ctfe2(int n){ int[] r=[]; if(n!=0) r~=[1]~ctfe2(n-1); return r; } return ctfe2(2).length == 2 ? "hello from runtime!" : "hello from compile time!"; } void main(){ pragma(msg,ctfe()); writeln(ctfe()); } $ dmd -run tt; hello from compile time! hello from runtime! $ The ctfe'd result is generally longer than the correct one. The example works as expected if ctfe2 is moved outside ctfe.
A workaround is to make ctfe2 a 'static function'.
https://github.com/D-Programming-Language/dmd/commit/1ebe10d6796db6acf62b456d6f908391ec4daad5 (subsequently reverted, and then recommitted).
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル