D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6284 - [Regression 2.054] 'pure' does not work with 'with' statement
Summary: [Regression 2.054] 'pure' does not work with 'with' statement
Status: RESOLVED DUPLICATE of issue 6293
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Mac OS X
: P2 regression
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2011-07-10 13:23 UTC by kennytm
Modified: 2011-08-01 21:44 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description kennytm 2011-07-10 13:23:23 UTC
Test case

-----------------------------
struct S {
    int a;
}
pure void bug6284() {
    S s;
    auto b = s.a;   // ok
    with (s) {
        auto c = a; // error
    }
}
-----------------------------
x.d(8): Error: pure nested function 'bug6284' cannot access mutable data 'a'
-----------------------------

The error does not happen in 2.053, probably due to the stricter pure check in 2.054.
Comment 1 kennytm 2011-07-10 13:30:33 UTC
(and yes, the regression is indeed introduced in commit 84b4f "tighten purity checks".

https://github.com/D-Programming-Language/dmd/commit/84b4f)
Comment 2 kennytm 2011-07-11 13:33:35 UTC
DMD pull #233.

https://github.com/D-Programming-Language/dmd/pull/233
Comment 3 kennytm 2011-07-12 13:22:25 UTC
DMD pull #243.

https://github.com/D-Programming-Language/dmd/pull/243
Comment 4 kennytm 2011-07-16 01:04:00 UTC
Merging into bug 6293 as the root causes are the same.

*** This issue has been marked as a duplicate of issue 6293 ***