[Issue 11740] [64-bit] Struct with constructor incorrectly passed on stack to extern(C++) function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 21 08:23:13 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11740



--- Comment #9 from yebblies <yebblies at gmail.com> 2013-12-22 03:23:12 EST ---
(In reply to comment #7)
> (In reply to comment #5)
> > extern(C++) functions must do what the corresponding c++ compiler does.
> 
> The definition of POD:
> 
> A PODS type in C++ is defined as either a scalar type or a PODS class. A PODS
> class has no user-defined copy assignment operator, no user-defined destructor,
> and no non-static data members that are not themselves PODS. Moreover, a PODS
> class must be an aggregate, meaning it has no user-declared constructors, no
> private nor protected non-static data, no base classes and no virtual
> functions.
> 
> 
> 
> So if g++ treats structs as POD if there is a user defined constructor, then
> that would be a problem - as it should not be treated it as POD, empty or
> non-empty.

It really doesn't matter if C++ thinks it's not a POD, or D thinks it's not a
POD.  The System V ABI considers it a POD, and we need to match it.

Again, http://www.x86-64.org/documentation/abi.pdf
"If a C++ object has either a non-trivial copy constructor or a non-trivial
destructor [11], it is passed by invisible reference (the object is replaced in
the parameter list by a pointer that has class INTEGER)[12]"

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list