[Issue 9154] Incorrectly generated assignment operator
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 13 19:57:19 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9154
--- Comment #1 from Andrei Alexandrescu <andrei at metalanguage.com> 2012-12-13 19:57:18 PST ---
Consider:
struct S {
int x;
void opAssign(ref S s) { }
}
struct T {
S member;
}
void main() {
T t1, t2;
t1 = t2;
}
This fails to compile with the error:
Error: cannot modify struct t1 T with immutable members
The error is caused by the "ref" in the definition of opAssign. Replacing "ref"
with "ref const" or "ref immutable" doesn't help, either.
The compiler should act mechanically here: the generated assignment for T
should simply perform a field-by-field assignment without nitpicking.
--
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