This CTFE code works: --- int f3(int a) { return a+5; } int foo() { auto fe = &f3; assert(fe(6) == 11); return 3; } static assert(foo()==3); --- But this is rejected: --- int f3(int a) { return a+5; } enum fe = &f3; static assert(fe(6)==11); --- test.d(5): Error: cannot evaluate (*& f3)(6) at compile time The difference is, that in the first case, fe is a variable. In the second case, it's a constant.
https://github.com/D-Programming-Language/dmd/commit/3055cc6a8b36a2e00c270b0e48e1d1bd2c931f37 https://github.com/D-Programming-Language/dmd/commit/72e750209b370b66157f320d3517c5816a3951d7
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル