Bug 14039 – [REG2.067a] function is incorrectly inferred as 'pure'

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-24T23:15:10Z
Last change time
2019-07-13T23:55:26Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Walter Bright
See also
https://issues.dlang.org/show_bug.cgi?id=20047

Comments

Comment #0 by bugzilla — 2015-01-24T23:15:10Z
void fa() {} auto fb10148(T)() { struct A(S) { void fc(T2)() { fa(); } this(S a) {} } return A!int.init; } void test10148() { fb10148!int.fc!int; } when compiled: foo.d(9): Error: pure function 'foo.fb10148!int.fb10148.A!int.A.fc!int.fc' cannot call impure function 'foo.fa' But calling fa() should have made fc() into an impure function.
Comment #1 by k.hara.pg — 2015-01-26T13:50:09Z
Comment #2 by github-bugzilla — 2015-01-28T10:59:40Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0acb94c7b8198b28386ed3c298e8c8a6829340be fix Issue 14039 - function is incorrectly inferred as 'pure' Fixes the interaction between issue 9148 behavior (more precise pure attribute annotation for nested functions) and purity inference. https://github.com/D-Programming-Language/dmd/commit/dfebd9cce97746aa9d32e4c980c50b5472bac578 Merge pull request #4344 from 9rnsr/fix14039 [REG2.067a] Issue 14039 - function is incorrectly inferred as 'pure'