www.digitalmars.com         C & C++   DMDScript  

D - Undefined __init_TypeInfo_g

reply MicroWizard <MicroWizard_member pathlink.com> writes:
I have found a problem with the D compiler.
(DMD 0.39 and 0.41 produce the same output.)
It looks like the compiler incorrectly handles
the slices and/or properties of a user defined type.

Is there any workaround?

Thanks,
Tamás (microwizard ax.hu)

Source bug.d:
-------------
debug(mychar)
{
alias byte mychar;
}

void main(char[][] arg)
{
debug(mychar)
{
mychar[] line=(mychar[])(char[])'It is a long line.';
mychar[] delimiter=(mychar[])(char[])'is';
}

debug(stdchar)
{
char[] line='It is a long line.';
char[] delimiter='is';
}

debug(stdbyte)
{
byte[] line=(byte[])(char[])'It is a long line.';
byte[] delimiter=(byte[])(char[])'is';
}

debug(stdwchar)
{
wchar[] line='It is a long line.';
wchar[] delimiter='is';
}
int ptr=3;

int dl=delimiter.length;
int pl=ptr+dl;

if(line[ptr..pl]==delimiter[])
{
printf("Yes.\n");
}
}

Compiler responses:
-------------------
E:\WORK\D>dmd -debug=stdchar bug
link bug,,,user32+kernel32/noi;

E:\WORK\D>dmd -debug=stdbyte bug
link bug,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

bug.obj(bug)
Error 42: Symbol Undefined __init_TypeInfo_g
--- errorlevel 1

E:\WORK\D>dmd -debug=mychar bug
link bug,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

bug.obj(bug)
Error 42: Symbol Undefined __init_TypeInfo_g
--- errorlevel 1

E:\WORK\D>dmd -debug=stdwchar bug
link bug,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

bug.obj(bug)
Error 42: Symbol Undefined __init_TypeInfo_u
--- errorlevel 1
Sep 10 2002
parent "Walter" <walter digitalmars.com> writes:
The bug is I haven't fleshed out all the typeinfo types.

"MicroWizard" <MicroWizard_member pathlink.com> wrote in message
news:alktbo$2i5r$1 digitaldaemon.com...
 I have found a problem with the D compiler.
 (DMD 0.39 and 0.41 produce the same output.)
 It looks like the compiler incorrectly handles
 the slices and/or properties of a user defined type.

 Is there any workaround?

 Thanks,
 Tamás (microwizard ax.hu)

 Source bug.d:
 -------------
 debug(mychar)
 {
 alias byte mychar;
 }

 void main(char[][] arg)
 {
 debug(mychar)
 {
 mychar[] line=(mychar[])(char[])'It is a long line.';
 mychar[] delimiter=(mychar[])(char[])'is';
 }

 debug(stdchar)
 {
 char[] line='It is a long line.';
 char[] delimiter='is';
 }

 debug(stdbyte)
 {
 byte[] line=(byte[])(char[])'It is a long line.';
 byte[] delimiter=(byte[])(char[])'is';
 }

 debug(stdwchar)
 {
 wchar[] line='It is a long line.';
 wchar[] delimiter='is';
 }
 int ptr=3;

 int dl=delimiter.length;
 int pl=ptr+dl;

 if(line[ptr..pl]==delimiter[])
 {
 printf("Yes.\n");
 }
 }

 Compiler responses:
 -------------------
 E:\WORK\D>dmd -debug=stdchar bug
 link bug,,,user32+kernel32/noi;

 E:\WORK\D>dmd -debug=stdbyte bug
 link bug,,,user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 bug.obj(bug)
 Error 42: Symbol Undefined __init_TypeInfo_g
 --- errorlevel 1

 E:\WORK\D>dmd -debug=mychar bug
 link bug,,,user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 bug.obj(bug)
 Error 42: Symbol Undefined __init_TypeInfo_g
 --- errorlevel 1

 E:\WORK\D>dmd -debug=stdwchar bug
 link bug,,,user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 bug.obj(bug)
 Error 42: Symbol Undefined __init_TypeInfo_u
 --- errorlevel 1
Sep 10 2002