ldc-developers/ldc — pull request #327 by redstar (2013-04-11 06:32:46+00:00)
Title: Fix for issue #326.

For a `foreach (int i, dchar c; str)` loop the compiler generates a delegate with a different type signature then the runtime uses.
The runtime declares the parameters as `void*` and passes a pointer to a `size_t` variable for the index. The code generated by the compiler expects a `ref int`. This works on a little endian architecture, but on a big endian architecture the index is always 0.

This fix changes the parameter type of the passed index to `size_t` and generates a cast to the type specified by the user.