Bug 6216 – Built-in opAssign implicitly defined should call field's opAssign

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-06-26T10:47:00Z
Last change time
2012-10-07T11:49:05Z
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2011-06-26T10:47:27Z
Following should compile. ---- struct X { int n; const void opAssign(const X rhs) {} } struct S { int n; const(X) x; } void main() { S s; s = s; } ---- test.d(14): Error: variable test.main.s cannot modify struct with immutable members ---- S has implicitly defined opAssign, but it does not call field x's opAssign.
Comment #1 by github-bugzilla — 2012-10-07T09:15:13Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/b9896d14766fe5a067cf84d0d2c21418dfb35676 fix Issue 6216 - Built-in opAssign implicitly defined should call field's opAssign Separate 'top assignable' (see opAssign first) from 'blit assignable' (memberwise), and now they are not related to 'modifiable' directly.
Comment #2 by yebblies — 2012-10-07T11:49:05Z