[PATCH 4/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to treat dynamic classes as non-trivial

Doug Evans dje@google.com
Tue Oct 14 21:01:00 GMT 2014

Siva Chandra writes:
 > On Mon, Sep 29, 2014 at 1:08 AM, Doug Evans <dje@google.com> wrote:
 > >> 2014-09-11  Siva Chandra Reddy  <sivachandra@google.com>
 > >>
 > >>         * gnu-v3-abi.c (gnuv3_pass_by_reference): Treat dynamic classes
 > >>         as non-trivial.
 > >
 > > This looks ok to me.
 > > I couldn't find anything in the ABI to guide me (could certainly have
 > > missed it), though it seems reasonable and it does fix the testcase.
 > The ABI defers the definition of triviality of copy constructors and
 > destructors to the C++ 98 final draft standard. The point under
 > question in this patch is under -6- here:
 > http://www.kouzdra.org/page/docs/isocpp/special.html#class.copy

Ah.  Thanks for the reference.

LGTM with one nit.

It'd be really nice to include a reference to the spec here.
I don't know about others, but this stuff is not the kind of
thing I tend to keep in cache, and when reading such code
it's really nice to be able to find the relevant sections
of the spec without any effort.

Does the following make sense?

+  /* A dynamic class has a non-trivial copy constructor.
+     See c++98 section 12.8 Copying class objects [class.copy].  */
+  if (gnuv3_dynamic_class (type))
+    return 1;

More information about the Gdb-patches mailing list