dmd 2.012, Linux dmd rejects code which the spec says should be valid (the spec doesn't mention any limitations to value parameters): BEGIN CODE template foo(void function() fp /*TPL...*/) {} void bar() {} alias foo!(&bar) a1; END CODE BEGIN dmd OUTPUT test.d(1): Error: arithmetic/string type expected for value-parameter, not void function() END OUTPUT BEGIN CODE (2nd manifestation) template foo(TPL...) {} void bar() {} alias foo!(&bar) a1; END CODE BEGIN dmd OUTPUT test.d(3): Error: expression & bar is not a valid template value argument test.d(3): template instance test.foo!(& bar) error instantiating END OUTPUT
This has just cropped up on IRC. Either the compiler should be fixed to match the spec, or the spec should be changed to match the compiler's behaviour. The simplest thing to do would be to change to spec to indicate that only strings, ints and floats are allowed as value parameters.
Commit pushed to https://github.com/D-Programming-Language/d-programming-language.org https://github.com/D-Programming-Language/d-programming-language.org/commit/5b1b3d5e5b9947fe8e9472d89250f6c12c2e9cf5 fix Issue 1943 - Templates can't take function pointer parameters
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル