The D documentation (https://dlang.org/spec/hash-map.html) leaves this not defined.
The foreach statement is defined to not allow it:
http://dlang.org/spec/statement.html#ForeachStatement"The aggregate must be loop invariant, meaning that elements to the aggregate cannot be added or removed from it in the NoScopeNonEmptyStatement."