Repository navigation
Conversation
There was a problem hiding this comment.
diag9620.main.bar is not a pure function, so this error message sounds weird to me.
There was a problem hiding this comment.
Doesn't being nested inside a pure function make it pure?
There was a problem hiding this comment.
No, currently bar is not marked as pure_. And *currently_ all of local functions (both static and nested) don't inherit pure attribute from enclosing function.
I think this is a bug in Expression::checkPurity(Scope *sc, FuncDeclaration *f). Even the static local function bar has no closest pure parent, but main is incorrectly detected for that.
There was a problem hiding this comment.
Ok, but this just changes 'D main' cannot call impure function 'diag9620.foo' to 'diag9620.main.bar' cannot call impure function 'diag9620.foo', which at least an improvement for non-static nested functions.
|
I removed the 'static' on the nested function. If the nested functions aren't (weakly) pure, how can they be called from a pure function and what should we call them? |
Print name of failing function, not enclosing function.
https://d.puremagic.com/issues/show_bug.cgi?id=9620