[cfe-dev] "byval" when there is a non-trivial Destructor or Copy Constructor

Eli Friedman eli.friedman at gmail.com
Wed Nov 2 15:52:03 PDT 2011


On Wed, Nov 2, 2011 at 3:14 PM, John McCall <rjmccall at apple.com> wrote:
> On Nov 2, 2011, at 2:33 PM, Jan Voung wrote:
>
> re: passing c++ objects with copy constructors/destructors, there are
> multiple ABIs for doing this (e.g., the gcc way, msvc way).
>
> There are?  How does MSVC do it that's not just passing a pointer to a
> temporary?  Is the callee responsible for copying into a temporary or
> something?  I can't imagine how that would work.

On MSVC, returning an class is roughly the same, but passing in a
class essentially does byval using the copy constructor instead of
memcpy.  I think there's a PR open about the fact that there isn't any
way to represent this construct in IR at the moment.

-Eli




More information about the cfe-dev mailing list