digitalmars.D.bugs - [Issue 2054] New: Const system broken on struct assignment.
- d-bugmail puremagic.com (30/30) Apr 28 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2054
- d-bugmail puremagic.com (6/10) Apr 28 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2054
- d-bugmail puremagic.com (5/12) Apr 28 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2054
- d-bugmail puremagic.com (9/9) May 22 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2054
http://d.puremagic.com/issues/show_bug.cgi?id=2054 Summary: Const system broken on struct assignment. Product: D Version: 2.012 Platform: PC OS/Version: Windows Status: NEW Keywords: accepts-invalid Severity: critical Priority: P1 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: brunodomedeiros+bugz gmail.com Const system broken on struct assignment: ---- ---- struct Struct { char* chptr; } void main() { char ch = 'd'; invariant Struct iStruct = {&ch}; Struct y = iStruct; // BREAKAGE *y.chptr = 'X'; // Because now we can do this } ---- ---- Like Andrei mentioned in accu-functional.pdf , such struct assignment should only be allowed if the struct refered to no mutable memory (which is not the case). --
Apr 28 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2054void main() { char ch = 'd'; invariant Struct iStruct = {&ch};I would believe this to be just as wrong. Mutable is not implicitly castable to invariant, and ch might change even though iStruct assumes it does not. --
Apr 28 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2054Duh me, that's right of course. Massive distraction of mine :S --void main() { char ch = 'd'; invariant Struct iStruct = {&ch};I would believe this to be just as wrong. Mutable is not implicitly castable to invariant, and ch might change even though iStruct assumes it does not.
Apr 28 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2054 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed dmd 2.014 --
May 22 2008