[Issue 3555] New: Const function modifies a field when passed a delegate
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Nov 28 04:43:31 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3555
Summary: Const function modifies a field when passed a delegate
Product: D
Version: 2.036
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: tomeksowi at gmail.com
--- Comment #0 from Tomasz Sowiński <tomeksowi at gmail.com> 2009-11-28 04:43:30 PST ---
I believe this should not compile:
class A
{ public:
int pole;
void funkcja(void delegate(int) dg) const
{
dg(3);
}
}
void main()
{
A a = new A;
void zmien(int w)
{
a.pole = w;
}
a.funkcja(&zmien); // pole changed by calling const funkcja
assert (a.pole == 3);
}
Looks very similar to bug 3534.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list