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.
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 }
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.
Works in DMD 2.011.
Both snippets still produce segmentation faults for me using a fresh DMD 2.011 and linux.
Works in DMD 1.055 and DMD 2.039