Sample code: ---- template TypeTuple(T...){ alias T TypeTuple; } struct tuple { TypeTuple!(int, int) field; alias field this; } auto front(T)(ref T arr){ return arr[0]; } void main() { auto bars = [tuple(0, 0), tuple(1, 1)]; auto spam = bars.front[1..2]; // } Output: ---- Error: variable __tup3 used before set
https://github.com/D-Programming-Language/dmd/pull/609
Tuple indexing has same problem. template TypeTuple(T...){ alias T TypeTuple; } struct tuple { TypeTuple!(int, int) field; alias field this; } auto front(T)(ref T arr){ return arr[0]; } void main() { auto bars = [tuple(0, 0), tuple(1, 1)]; auto spam1 = bars.front[1]; // indexing auto spam2 = bars.front[1..2]; // slicing }
Works for me, presumably fixed by the fix to issue 4940 https://github.com/D-Programming-Language/dmd/commit/d6ede2edc28c94b6b3372eb1301cf300b0860eb6