struct Always3
{
enum empty = false;
auto save() { return this; }
long front() { return 3; }
void popFront() {}
long opIndex(size_t i) { return 3; }
long opIndex(size_t i) immutable { return 3; };
}
void main()
{
import std.algorithm.iteration : map;
Always3.init.map!"a"[size_t.max];
}
outputs:
Error: function std.algorithm.iteration.MapResult!(unaryFun, Always3).MapResult.opIndex(uint index) is not callable using argument types (ulong)
MapResult checks if it can call opIndex with ulong.max and fails for some reason. Changing the check from is(typeof(_input[ulong.max])) to is(typeof(() => _input[ulong.max])) fixes the problem.