[Issue 19841] Wrong ABI for C++ functions taking a struct by value
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 7 04:55:15 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=19841
--- Comment #6 from Walter Bright <bugzilla at digitalmars.com> ---
D's definition of POD is:
1. it is not nested
2. it has no postblits, destructors, or assignment operators
3. it has no ref fields or fields that are themselves non-POD
https://dlang.org/spec/struct.html#POD
C++'s definition is quite a bit more complicated, and changes from one version
of the Standard to another:
https://stackoverflow.com/questions/4178175/what-are-aggregates-and-pods-and-how-why-are-they-special/7189821#7189821
For reference, "the equivalent C++ code" is:
struct Foo {
char _[32];
};
struct Bar {
Bar(Foo foo);
};
void oops() {
auto foo = Foo();
auto bar = Bar(foo);
}
--
More information about the Digitalmars-d-bugs
mailing list