digitalmars.D.bugs - [Issue 8781] New: delegate breaks const/immutable/shared correctness
- d-bugmail puremagic.com (47/47) Oct 08 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8781
- d-bugmail puremagic.com (11/11) Jul 26 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8781
http://d.puremagic.com/issues/show_bug.cgi?id=8781
Summary: delegate breaks const/immutable/shared correctness
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: zan77137 nifty.com
This code show an issue of const/immutable/shared correctness:
----------------------------------------------------
class A
{
int x;
void foo() { x++; }
}
void main()
{
auto a = new immutable(A);
auto x = a.x;
auto dg = &a.foo; // NG: immutable instance of A has been converted
implicitly to mutable instance of A
dg(); // NG: immutable memory field is broken.
auto y = a.x;
assert(x == y); // NG: 0 == 1
}
----------------------------------------------------
Similar issue:
----------------------------------------------------
class B
{
void bar() shared { }
}
void main()
{
auto b = new B;
auto dg = &b.bar; // NG: unshared instance of B has been converted
implicitly to shared instance of B
}
----------------------------------------------------
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 08 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8781
Kenji Hara <k.hara.pg gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
*** This issue has been marked as a duplicate of issue 1983 ***
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 26 2013








d-bugmail puremagic.com