This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA (tree-inline): PATCH for C++ inheriting constructors overhaul


wg21.link/p0136 significantly changes the specification of C++11
inheriting constructors so that they become an implementation detail
rather than a language-level construct; instead, overload resolution
and such are done on the constructor from the base, and the artificial
constructor in the derived class comes in only later.  As a result,
several things that worked poorly with the old specification work much
better.  But this changes the representation as well; as a result, the
mangled name of the artificial inherited constructor is changing.

This proposal is part of C++17, but it is specified as a defect report
against C++11 and C++14 as well, so the new behavior affects those
modes as well.  The change can be controlled with
-fno-new-inheriting-ctors, and it is also disabled by default with
-fabi-version=10 or below.

One subtlety with the new scheme is that base constructor clones of an
inheriting constructor that inherits from a virtual base don't get the
inherited parameters, since they won't actually call the constructor
for the virtual base; only the complete constructor clone does that.

For the cloning code to handle omitted inherited parms, I needed to
change copy_tree_body_r to immediately optimize away a COND_EXPR with
a constant condition, as the non-taken branch would try to pass the
omitted parameters to the virtual base constructor.

Is the tree-inline.c patch OK for trunk?

Attachment: new-inh-ctor.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]