https://issues.dlang.org/show_bug.cgi?id=16608
--- Comment #3 from Ali Cehreli <acehr...@yahoo.com> --- Thanks. I forgot to add another thing that Johan had discovered: I don't know whether this is an implementation issue but if static foreach can be seen as an expansion of the loop body as separate scopes then the following case seems to be related to this bug. There can't be two nested functions even if they are in different scopes: void main() { { void foo(){} } { void foo(){} // <-- Error } } Error: declaration foo is already defined in another scope in main --