Bug 6684 – Wrong code for null-initializing a class with alias this.
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-09-17T02:22:00Z
Last change time
2011-09-17T03:57:26Z
Assigned to
nobody
Creator
timon.gehr
Comments
Comment #0 by timon.gehr — 2011-09-17T02:22:42Z
class Foo{
string bar;
alias bar this;
}
void main(){
Foo foo = null; // segmentation fault at runtime
}
The compiler attempts to assign to foo's 'bar' field, instead of initializing the class reference with zero. That always results in a segmentation fault.
Comment #1 by yebblies — 2011-09-17T03:57:26Z
Fixed already on github.
*** This issue has been marked as a duplicate of issue 6630 ***