Issue 9148 - 'pure' is broken

https://issues.dlang.org/show_bug.cgi?id=9148

A nested function inside `pure` function should also be typed as `pure`, and considered as weak purity function.
@9rnsr: That example does not show broken behaviour. The return type of test() would be int delegate()[]. Then the calls `f[0]()` and `f[1]()` in main are impure and the behaviour is not at all surprising. I am just saying that banning ++g categorically is not the right thing to do here. It is perfectly valid for a pure function to compute a result that contains impure delegates. It just may not call those itself. Purity for nested functions should be inferred based on the nested function body and not based on whether the enclosing function is pure. However, I am not opposed to merging this pull request, this restriction can be lifted later. I'll file some issues as soon as this is merged. (Another thing that is still missing is inference of the 'immutable' attribute.) The pull fixes the main concerns of issue 9148 though. Thanks!

@jmdavis: There is no reason to _infer_ purity if the function is not actually pure and this is just going to cause a compile time error.