http://d.puremagic.com/issues/show_bug.cgi?id=2856
Summary: static opIndex does not compile for a templated struct/class Product: D Version: 2.027 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P3 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: sandf...@jhu.edu 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]) --