I have this piece of code:

```d
import std.stdio;
import std.container : SList;
import std.algorithm : each;
import std.range : retro;

void frob(const string s) {
    SList!char ll;
    s.retro.each!(c => ll.insertFront(c));
    foreach (c; ll)
        c.write;
    writeln;
}
```

If i remove the call to `retro`, it compiles just fine. If i change `each`'s operation to something like `writeln`, it compiles just fine. But unchanged, this program will not compile and will give this error:

```
test.d:8:12: error: none of the overloads of template ‘test.frob.each!((c) => ll.insertFront(c)).each’ are callable using argument types ‘!()(Result!())’
    8 |     s.retro.each!(c => ll.insertFront(c));
      |            ^
/usr/lib/gcc/x86_64-pc-linux-gnu/15.2.1/include/d/std/algorithm/iteration.d:912:17:
 note: Candidates are: ‘each(Range)(Range r)’
  with `Range = Result!()`
  must satisfy one of the following constraints:
`       isRangeIterable!Range
       __traits(compiles, typeof(r.front).length)`
  912 |     Flag!"each" each(Range)(Range r)
      |                 ^
/usr/lib/gcc/x86_64-pc-linux-gnu/15.2.1/include/d/std/algorithm/iteration.d:973:17:
 note:                 ‘each(Iterable)(auto ref Iterable r)’
  with `Iterable = Result!()`
  must satisfy one of the following constraints:
`       isForeachIterable!Iterable
       __traits(compiles, Parameters!(Parameters!(r.opApply)))`
  973 |     Flag!"each" each(Iterable)(auto ref Iterable r)
      |                 ^
```

I'm using GDC.

Reply via email to