March 19, 2017
After minimizing a more complex program I got the following small example that produces a rather strange error.
The error says that MapResult has no field '_input' although the sole MapResult definition has such a field.

What is the explanation for this error?

auto foo(T)(T )
    import std.algorithm : joiner, map;
    import std.array : array;

    enum a = "x".map!(j => `"".map!(y =>`);
    enum b = a.joiner;
    enum c = b.array;

    return mixin("[" ~ c ~ "]");

void main()

Compiler output (dmd 2.073.2):

% rdmd foo.d
/usr/include/dmd/phobos/std/algorithm/iteration.d(580): Error: couldn't find field _input of type const(char[]) in MapResult("x", null)
/usr/include/dmd/phobos/std/algorithm/iteration.d(580):        called from here: empty(this._input)
/usr/include/dmd/phobos/std/algorithm/iteration.d(2402):        called from here: this._items.empty()
/usr/include/dmd/phobos/std/algorithm/iteration.d(2453):        called from here: Result(MapResult, null).this(r)
foo.d(8):        called from here: joiner(MapResult("x", null))
foo.d-mixin-11(11): Error: template instance!dchar error instantiating
/usr/include/dmd/phobos/std/algorithm/iteration.d(593):        instantiated from here: __lambda3!dchar
/usr/include/dmd/phobos/std/algorithm/iteration.d(488):        instantiated from here: MapResult!(__lambda3, string)
foo.d-mixin-11(11):        instantiated from here: map!string
foo.d(16):        instantiated from here: foo!string
Failed: ["dmd", "-v", "-o-", "foo.d", "-I."]