www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1811] New: TypeInfo usage leads to seg fault at runtime

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1811

           Summary: TypeInfo usage leads to seg fault at runtime
           Product: D
           Version: 2.010
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: kamm-removethis incasoftware.de


The code

import std.stdio;

class Base
{
    int foo() { return 0; }
}

class Sub : Base
{
    override int foo() { return 0; }
}

void main()
{
   auto t1 = typeid(typeof(Sub.foo));
   auto t2 = typeid(typeof(Base.foo)); // <- comment to fix

   t1.tsize(); // crash
}

compiles fine, but crashes when run.


-- 
Jan 30 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1811






-------
Note that classes or virtual functions are not responsible. The same behaviour
is shown by

import std.stdio;

void main()
{
   int foo() { return 0; }
   int bar() { return 0; }

   auto t1 = typeid(typeof(foo));   
   auto t2 = typeid(typeof(bar));

   t1.tsize(); // crash
}


-- 
Jan 30 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1811






-------
I think it is related to 1522, as I get a multiple definition linker error for
_D12TypeInfo_FZi6__initZ when feeding the code to DMD 1.021.


-- 
Jan 30 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1811


bugzilla digitalmars.com changed:

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





Works in DMD 2.011.


-- 
Mar 04 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1811


kamm-removethis incasoftware.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |





-------
Both snippets still produce segmentation faults for me using a fresh DMD 2.011
and linux.


-- 
Mar 05 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1811


Alexey Ivanov <aifgi90 gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
                 CC|                            |aifgi90 gmail.com
         Resolution|                            |WORKSFORME



---
Works in DMD 1.055 and DMD 2.039

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 27 2010