D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 13187 - Function wrongly deduced as pure
Summary: Function wrongly deduced as pure
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: accepts-invalid, pull
Depends on:
Blocks:
 
Reported: 2014-07-22 15:19 UTC by Marc Schütz
Modified: 2014-08-22 08:05 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Marc Schütz 2014-07-22 15:19:22 UTC
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`.
Comment 1 Kenji Hara 2014-08-10 12:44:57 UTC
It's a regression introduced in: https://github.com/D-Programming-Language/dmd/pull/3303
Comment 3 github-bugzilla 2014-08-10 13:48:02 UTC
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
Comment 4 github-bugzilla 2014-08-10 15:03:54 UTC
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
Comment 5 github-bugzilla 2014-08-22 08:05:20 UTC
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