|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
digitalmars.D.dtl - MinTL segfault.
This is likely a bug in dmd, probably related to digitalmars.D.bugs/1810 dmd 0.101 on Linux. #import mintl.util; # #/* Segmentation fault when Base is an interface. Okay when Base is a #class. */ #interface Base #//class Base #{ # int id(); #// int id() { return 0; } #} # #class Foo : Base #{ # int id() { return 123; } #} # #class Bar : Base #{ # int id() { return 987; } #} # #int main() #{ # Foo foo = new Foo; // Declaring foo and bar as Base # Bar bar = new Bar; // does not help. # # SortedSet!(Base) set; # # set[foo] = foo; # set[bar] = bar; # # printf("Length set = %d.\n", set.length()); # # foreach( Base b; set ) printf("id: = %d.\n", b.id() ); # return 0; #} Sep 13 2004
Bummer. It looks like TypeInfo compare functions are busted for interfaces. If you try to run TypeInfo ti = typeid(foo); ti.compare(&foo,&bar); you'll error out. On win32 I get a Win32 Exception. Probably since the declaration of compare is with void* instead of a specific type it gets all confused about calling opCmp. Nasty. I'm cross-posting to bugs. "Bastiaan Veelo" <Bastiaan.N.Veelo ntnu.no> wrote in message news:ci495h$1alr$1 digitaldaemon.com...This is likely a bug in dmd, probably related to digitalmars.D.bugs/1810 dmd 0.101 on Linux. #import mintl.util; # #/* Segmentation fault when Base is an interface. Okay when Base is a #class. */ #interface Base #//class Base #{ # int id(); #// int id() { return 0; } #} # #class Foo : Base #{ # int id() { return 123; } #} # #class Bar : Base #{ # int id() { return 987; } #} # #int main() #{ # Foo foo = new Foo; // Declaring foo and bar as Base # Bar bar = new Bar; // does not help. # # SortedSet!(Base) set; # # set[foo] = foo; # set[bar] = bar; # # printf("Length set = %d.\n", set.length()); # # foreach( Base b; set ) printf("id: = %d.\n", b.id() ); # return 0; #} Sep 13 2004
|