This code fails compilation: void test () { } // Compiles okay. auto a = &test; // Error: non-constant expression __funcliteral1 auto b = function void () { }; As far as I can tell there is no reason for function literals to be non-constant if they're not synthesized during runtime.
*** Issue 5143 has been marked as a duplicate of this issue. ***
It may be useful to know that void main() { auto a = function void() {}; } compiles correctly, but when a is moved outside main the Error occurs.
Fixed for D2 https://github.com/D-Programming-Language/dmd/commit/8945eae1b37f1fdc96850cff697959deb2d64e6a
And D1: https://github.com/D-Programming-Language/dmd/commit/36cee746c53c2a3dac11116e1f4c3e0563a0534c
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル