Bug 13044 – Assignment of structs with const members

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-04T16:27:00Z
Last change time
2014-08-22T08:04:13Z
Keywords
accepts-invalid, pull
Assigned to
nobody
Creator
stanislav.blinov

Comments

Comment #0 by stanislav.blinov — 2014-07-04T16:27:08Z
DMD 2.065, 2.066b1 If a struct has a const member and a dtor defined, instances of that struct can be assigned. unittest { struct Good { const int i; } struct Bad { const int i; ~this() {} } Good good1, good2; static assert(!__traits(compiles, { good1 = good2; }); // passes Bad bad1, bad2; static assert(!__traits(compiles, { bad1 = bad2; }); // fails }
Comment #1 by k.hara.pg — 2014-07-06T14:04:45Z
Comment #2 by github-bugzilla — 2014-07-06T16:39:54Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/6c455a3f18a617d168da65bb0bba99b2fd6f6715 fix Issue 13044 - Assignment of structs with const members https://github.com/D-Programming-Language/dmd/commit/4933d0a3101a0601e11e42a22f95b79908ae35d3 Merge pull request #3724 from 9rnsr/fix13044 Issue 13044 - Assignment of structs with const members
Comment #3 by github-bugzilla — 2014-07-08T01:25:10Z
Commit pushed to 2.066 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ffc55a074c0a5bbce7065122cb61787b0ac0ba10 Merge pull request #3724 from 9rnsr/fix13044 Issue 13044 - Assignment of structs with const members
Comment #4 by github-bugzilla — 2014-08-22T08:04:13Z