D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6684 - Wrong code for null-initializing a class with alias this.
Summary: Wrong code for null-initializing a class with alias this.
Status: RESOLVED DUPLICATE of issue 6630
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-17 02:22 UTC by timon.gehr
Modified: 2011-09-17 03:57 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description timon.gehr 2011-09-17 02:22:42 UTC
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 yebblies 2011-09-17 03:57:26 UTC
Fixed already on github.

*** This issue has been marked as a duplicate of issue 6630 ***