D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6298 - ref breaks struct immutability
Summary: ref breaks struct immutability
Status: RESOLVED DUPLICATE of issue 5493
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2011-07-12 11:52 UTC by bearophile_hugs
Modified: 2011-07-12 13:05 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 bearophile_hugs 2011-07-12 11:52:22 UTC
With DMD 2.054 this code compiles and runs, but I think this is not good:


struct Foo {
    int x;
}
void bar(ref Foo f) {
    f.x++;
}
void main() {
    immutable Foo f;
    bar(f);
}
Comment 1 Steven Schveighoffer 2011-07-12 13:05:59 UTC

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