digitalmars.D.bugs - [Issue 2490] New: extern(C++) can not handle structs as return types
- d-bugmail puremagic.com (52/52) Dec 03 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2490
- d-bugmail puremagic.com (9/9) Dec 25 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2490
http://d.puremagic.com/issues/show_bug.cgi?id=2490 Summary: extern(C++) can not handle structs as return types Product: D Version: 2.014 Platform: PC OS/Version: Linux Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: jason.james.house gmail.com The code below shows that the this pointer gets corrupted when this code compiles and runs. Sample output: Bar = 0x81c33a8 This = 0xbf8dce20 cpp file: #include <iostream> struct foo{ int i; int j; }; class bar{ public: virtual foo getFoo(){ std::cout << "This = " << this << std::endl; foo f; return f; } }; bar* newBar(){ bar* b = new bar(); std::cout << "Bar = " << b << std::endl; return b; } d file: extern(C++){ struct foo{ int i; int j; } interface bar{ foo getFoo(); } bar newBar(); } void main(){ bar b = newBar(); foo f = b.getFoo(); } --
Dec 03 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2490 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed dmd 1.038 amd 2.022 --
Dec 25 2008