www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - typeid in template scope codegeneration bug

reply Victor Nakoryakov <nail-mail mail.ru> writes:
// --- tmpl.d ---
module tmpl;

class TemplateClass(T)
{
	void* p = cast(void*)typeid(T);
}

// --- core.d ---
module core;
private import tmpl;

class A
{
	int a;
}

int main(char[][] args)
{
	TemplateClass!(A) tc = new TemplateClass!(A)();
	return 0;
}

dmd -I. -IC:\dmd\src\phobos -c -ofcore.obj core.d
dmd -I. -IC:\dmd\src\phobos -c -oftmpl.obj tmpl.d
dmd -oftest.exe core.obj tmpl.obj
C:\dmd\bin\..\..\dm\bin\link.exe core+tmpl,test.exe,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

core.obj(core)
  Error 42: Symbol Undefined __init_17TypeInfo_C4core1A


If I'll try to compile both sources in one dmd call i.e.
# dmd -I. -IC:\dmd\src\phobos core.d tmpl.d
all compiles and links fine. This bug prevents std.boxer from being usable.


-- 
Victor (aka nail) Nakoryakov
nail-mail<at>mail<dot>ru

Krasnoznamensk, Moscow, Russia
Jul 06 2005
parent Thomas Kuehne <thomas-dloop kuehne.this-is-spam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Victor Nakoryakov schrieb am Wed, 06 Jul 2005 20:56:56 +0400:
 // --- tmpl.d ---
 module tmpl;

 class TemplateClass(T)
 {
 	void* p = cast(void*)typeid(T);
 }

 // --- core.d ---
 module core;
 private import tmpl;

 class A
 {
 	int a;
 }

 int main(char[][] args)
 {
 	TemplateClass!(A) tc = new TemplateClass!(A)();
 	return 0;
 }

 dmd -I. -IC:\dmd\src\phobos -c -ofcore.obj core.d
 dmd -I. -IC:\dmd\src\phobos -c -oftmpl.obj tmpl.d
 dmd -oftest.exe core.obj tmpl.obj
 C:\dmd\bin\..\..\dm\bin\link.exe core+tmpl,test.exe,,user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 core.obj(core)
   Error 42: Symbol Undefined __init_17TypeInfo_C4core1A


 If I'll try to compile both sources in one dmd call i.e.
 # dmd -I. -IC:\dmd\src\phobos core.d tmpl.d
 all compiles and links fine. This bug prevents std.boxer from being usable.

Added to DStress as typeinfo_init_01 and typeinfo_init_02 http://dstress.kuehne.cn/complex/typeinfo_init Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFC39ja3w+/yD4P9tIRAohWAKCVLPFN9CJWQkOeRQuLSaOmYCyesQCcCzXK NaDoVvvnxWEnVe1nRDac6u8= =Wrxk -----END PGP SIGNATURE-----
Jul 21 2005