← Back to index
|
Original Bugzilla link
Bug 6610 – opAssign when copy-ing array
Status
NEW
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-09-06T02:47:02Z
Last change time
2024-12-13T17:56:21Z
Assigned to
No Owner
Creator
luka8088
Moved to GitHub: dmd#18368 →
Comments
Comment #0
by luka8088 — 2011-09-06T02:47:02Z
/* * As discussed on #d @ freenode on 2011-09-06 * Should this work ? * */ import std.stdio; struct s { int a; int b; int c; void opAssign (s value) { // Should opAssign be call for each array member ? (&this)[0..1] = (&value)[0..1]; // causes infinite loop (as it should) // this = value; this.c = 4; } } void main () { writeln("start"); s s1; s1.a = 1; s1.b = 2; s1.c = 3; s s2; s2 = s1; writeln(s1.a, " ", s1.b, " ", s1.c); // 1 2 3 writeln(s2.a, " ", s2.b, " ", s2.c); // 1 2 4 writeln("end"); }
Comment #1
by robert.schadek — 2024-12-13T17:56:21Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/dmd/issues/18368
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB