Static opIndex functions result in compile time errors for templated structs and classes. Using a typedef, fixes the issue. static opCall and generic static functions don't appear to be affected. Test case: import std.stdio; struct foo { static void opIndex(int i) { writefln("foo"); } } struct bar(T) { static void opIndex(int i) { writefln("bar"); } } int main(char[][] args) { foo[1]; //bar!(float)[1]; // Error (# = __LINE__) typedef bar!(float) B; B[1]; // Okay return 0; } main.d:#: Error: struct bar must be an array or pointer type, not void main.d:#: Error: [i] has no effect in expression (struct bar[1])
https://github.com/D-Programming-Language/dmd/pull/453
https://github.com/D-Programming-Language/dmd/commit/1e0aa894292a969cb7149d2bdb76d7576e291e79 https://github.com/D-Programming-Language/dmd/commit/8857ba8f88a5e9a7f39dba6bcd98bc2de9820cd4
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル