This compiles: int function(int) pure my_func_ptr; struct WronglyPure { static opDispatch(string fn, Args...)(Args args) { return mixin(fn)(args); } } int test() pure { return WronglyPure.my_func_ptr(1); } Evidently, `opDispatch` is deduced as pure, but it shouldn't be, because it access the global variable `my_func_ptr`.
It's a regression introduced in: https://github.com/D-Programming-Language/dmd/pull/3303
https://github.com/D-Programming-Language/dmd/pull/3864
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/184a52f0d9c00b06d451426198c892ff50bb7099 fix Issue 13187 - Function wrongly deduced as pure https://github.com/D-Programming-Language/dmd/commit/125f5e9341730fd09d4ab83c1de33742435dab20 Merge pull request #3864 from 9rnsr/fix13187 [REG2.066a] Issue 13187 - Function wrongly deduced as pure
Commit pushed to 2.066 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/6a9ef9a5c798428845f0437884eaf92d3c7a80e6 Merge pull request #3864 from 9rnsr/fix13187 [REG2.066a] Issue 13187 - Function wrongly deduced as pure
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/6a9ef9a5c798428845f0437884eaf92d3c7a80e6 Merge pull request #3864 from 9rnsr/fix13187