Thread overview
[Issue 462] New: invalid typeinfo usage breaks dmd compiler
Oct 26, 2006
d-bugmail
Nov 08, 2006
Thomas Kuehne
Nov 15, 2006
d-bugmail
October 26, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=462

           Summary: invalid typeinfo usage breaks dmd compiler
           Product: D
           Version: 0.172
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: davidl@126.com


import std.stdio;
struct myobject
{
        TypeInfo objecttype;
        void * offset;
}

myobject[] list;
class
off
{
        int i;
        int j;
        void setserial()
        {
                list.length=list.length+1;
                list[list.length-1].typeinfo=i.typeinfo;              // this
breaks dmd
                list[list.length-1].objecttype=typeid(typeof(i));

list[list.length-1].offset=cast(void*)((cast(void*)(&i))-(cast(void*)this));
                list.length=list.length+1;
                list[list.length-1].objecttype=typeid(typeof(j));

list[list.length-1].offset=cast(void*)((cast(void*)(&j))-(cast(void*)this));
        }
}
void main()
{
        off a=new off;
        a.setserial();
//      serial(b);

}


-- 

November 08, 2006
d-bugmail@puremagic.com schrieb am 2006-10-26:
> http://d.puremagic.com/issues/show_bug.cgi?id=462

> import std.stdio;
> struct myobject
> {
>         TypeInfo objecttype;
>         void * offset;
> }
>
> myobject[] list;
> class
> off
> {
>         int i;
>         int j;
>         void setserial()
>         {
>                 list.length=list.length+1;
>                 list[list.length-1].typeinfo=i.typeinfo;              // this
> breaks dmd
>                 list[list.length-1].objecttype=typeid(typeof(i));
> 
> list[list.length-1].offset=cast(void*)((cast(void*)(&i))-(cast(void*)this));
>                 list.length=list.length+1;
>                 list[list.length-1].objecttype=typeid(typeof(j));
> 
> list[list.length-1].offset=cast(void*)((cast(void*)(&j))-(cast(void*)this));
>         }
> }
> void main()
> {
>         off a=new off;
>         a.setserial();
> //      serial(b);
>
> }

Added to DStress as http://dstress.kuehne.cn/nocompile/t/typeinfo_02_A.d http://dstress.kuehne.cn/nocompile/t/typeinfo_02_B.d http://dstress.kuehne.cn/nocompile/t/typeinfo_02_C.d

Thomas


November 15, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=462


deewiant@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from deewiant@gmail.com  2006-11-15 02:59 -------
Fixed in DMD 0.174.


--