Thread overview | ||||||
---|---|---|---|---|---|---|
|
July 27, 2014 [Issue 13207] Wrong code for 'extern' C/C++ function returning struct | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13207 --- Comment #1 from Denis Shelomovskij <verylonglogin.reg@gmail.com> --- And a C++ example where it segfaults: D code: --- const size_t n = 8; // yes, even fits in a register struct S1 { long l; } // good struct S2 { byte[n] arr; } // causes errors static assert(S1.sizeof == n); static assert(S2.sizeof == n); extern(C++) interface I { size_t getN(); S1 getS1(); S2 getS2(); } class C: I { extern(C++): size_t getN() { return n; } S1 getS1() { return S1(); } // correct code S2 getS2() { return S2(); } // wrong code } extern(C) I getI() { return new C; } --- C++ code: --- const size_t n = 8; struct S { char arr[n]; }; static_assert(sizeof(S) == n, "Size mismath."); class I { public: virtual size_t getN() = 0; virtual S getS1() = 0; virtual S getS2() = 0; }; extern "C" I *getI(); int main() { rt_init(); I *i = getI(); assert(i->getN() == n); // simple test S s1 = i->getS1(); // ok S s2 = i->getS2(); // segfaults rt_term(); return 0; } --- -- |
July 27, 2014 [Issue 13207] Wrong code for 'extern' C/C++ function returning struct | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13207 --- Comment #2 from Denis Shelomovskij <verylonglogin.reg@gmail.com> --- Also note there is Issue 9931, but it's marked as x86 only. -- |
May 23, 2017 [Issue 13207] Wrong code for 'extern' C/C++ function returning struct | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13207 anonymous4 <dfj1esp02@sneakemail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=16527 -- |
July 02, 2017 [Issue 13207] Wrong code for 'extern' C/C++ function returning struct | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13207 Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |dlang-bugzilla@thecybershad | |ow.net Resolution|--- |INVALID --- Comment #3 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> --- These test cases are very badly incomplete. The C source code is incomplete, it is at least missing includes to things obviously used in the presented code, but I'm also getting numerous other errors. There are no command lines. There are no compiler versions. There is no compiler or linker output. I am closing this because this is very far from being reproducible and was filed 3 years ago. Please reopen if you can post complete, self-contained, reproducible test cases. -- |
Copyright © 1999-2021 by the D Language Foundation