The foreach/opApply docs acknowledge that the Aggregate in a foreach statement might be a delegate, but that section needs to be fleshed out with more text and/or an example or two: ~~~~~~~~~~ Foreach over Delegates If Aggregate is a delegate, the type signature of the delegate is of the same as for opApply. This enables many different named looping strategies to coexist in the same class or struct. ~~~~~~~~~~
Wow this bug is old. About time somebody did something about it!! https://github.com/D-Programming-Language/dlang.org/pull/658
Commit pushed to master at https://github.com/D-Programming-Language/dlang.org https://github.com/D-Programming-Language/dlang.org/commit/58087a37bd3129ff11c5c2d85c6b6891bcd878ed Merge pull request #658 from quickfur/issue4954 Add code example for foreach over delegate.