[Issue 4416] Function with ref argument breaks struct method const attribute
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Aug 29 19:48:11 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4416
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrej.mitrovich at gmail.com
--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2010-08-29 19:47:59 PDT ---
This also breaks immutable class objects, which is really bad:
void spam(ref int x)
{
x++;
}
class Foo
{
int x = 5;
void bar() immutable {
spam(x);
}
}
void main()
{
auto b = new immutable(Foo);
//~ b.x = 10; // uncommment for error
assert(b.x == 5);
b.bar();
assert(b.x == 6);
}
If you uncomment b.x = 10, you will of course get an error. Maybe raise this
bug to a higher priority?
--
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