← Back to index
|
Original Bugzilla link
Bug 3360 – segfault with alias this and inner classes
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2009-10-02T10:55:00Z
Last change time
2014-02-14T20:35:23Z
Keywords
wrong-code
Assigned to
nobody
Creator
andrei
Comments
Comment #0
by andrei — 2009-10-02T10:55:47Z
This correct example causes a segfault: import std.stdio; class Base1 { void fun() { writeln("Base.fun"); } } class Base2 { void gun() { writeln("Base.fun"); } } class Multiple : Base1 { // Override method in Base1 override void fun() { writeln("Multiple.fun"); } // Override method in Base2 class MyBase2 : Base2 { override void gun() { writeln("Multiple.gun"); } } // Effect multiple inheritance Base2 _base2; alias _base2 this; this() { _base2 = new MyBase2; } } void main() { auto obj = new Multiple; Base1 obj1 = obj; obj1.fun(); Base2 obj2 = obj; obj2.gun(); } Replacing obj2.gun() with obj.gun() makes the code work.
Comment #1
by yebblies — 2011-06-12T21:45:12Z
Works in current dmd (2.053)