Thanks Robert Meanwhile, I also found that my code works it I change parameter type to int instead of size_t. Looks like DMD fails because of some issue with implicit conversions (or lack of it) between integral types.
Anyway the solution you provided is more elegant and I will adopt that. Regards - Puneet
