Class inheritance bug

Tobias M. tobias.m at onlinehome.de
Fri Nov 11 12:28:41 PST 2011


No, this is seriously a bug. I tried around to get it linked correctly 
but kept failing. So then i tried to find a general example and here it is:
---------test.d---------
module test;
abstract class Foobar {
	this(string arg) {
		// do sth.
	}
}
class Blub : Foobar {
	this(string arg) {
		super(arg);
		// do sth.
	}
}
---------END---------
Compiling on Windows7(32bit) SP1 with DMD 2.056 (for some reason) using 
phobos 2.055:
---------command prompt---------
C:\Users\Tobse\Documents\chat>dmd test.d
OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Warning 23: No Stack
test.obj(test)
  Error 42: Symbol Undefined _D14TypeInfo_Class6__vtblZ
test.obj(test)
  Error 42: Symbol Undefined _D6Object7__ClassZ
test.obj(test)
  Error 42: Symbol Undefined _D6object6Object8opEqualsMFC6ObjectC6ObjectZb
test.obj(test)
  Error 42: Symbol Undefined _D6object6Object6toHashMFZk
test.obj(test)
  Error 42: Symbol Undefined _D6object6Object8toStringMFZAya
test.obj(test)
  Error 42: Symbol Undefined _D6object6Object5opCmpMFC6ObjectZi
test.obj(test)
  Error 42: Symbol Undefined _D6object6Object8opEqualsMFC6ObjectZb
OPTLINK : Warning 134: No Start Address
--- errorlevel 7
---------END---------

while this compiles, links and runs perfectly:
---------test.d---------
module test;
abstract class Foobar {
	this(string arg) {
		// do sth.
	}
}
class Blub : Foobar {
	this(string arg) {
		super(arg);
		// do sth.
	}
}

void main() {
	// do sth.
}
---------END---------

---------command prompt---------
C:\Users\Tobse\Documents\chat>dmd test.d

C:\Users\Tobse\Documents\chat>test
Hello World!
---------END---------


So i could implement the functions toHash, toString, opCmpMF and 
opEquals (as these symbols are undefined), but thats not the way the 
language reference on d-programming-language.org documents class 
inheritance.
Finally, from my point of view, this is a bug.


More information about the Digitalmars-d mailing list