← Back to index
|
Original Bugzilla link
Bug 1700 – ICE attempting to modify member of const return struct
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2007-11-29T19:04:00Z
Last change time
2015-06-09T01:14:22Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
wbaxter
Comments
Comment #0
by wbaxter — 2007-11-29T19:04:14Z
module conststructreturn; import std.stdio; struct Strukt { int value = 10; int opPostInc() { value++; return value; } } class Klass { const(Strukt) opIndex(int i) { return Strukt(i*i); } } void main() { auto k = new Klass; k[4]; //ok k[4]++; // ok -- (compiler error) writefln(k[4].value); // OK k[4].value = 1; // CRASH k[4].value += 1; // CRASH k[4].value++; // CRASH }
Comment #1
by bugzilla — 2008-02-16T06:00:56Z
Fixed dmd 2.010