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]

Re: [PATCH] c++/78771 ICE with inheriting ctor


On 12/19/2016 08:09 AM, Nathan Sidwell wrote:
this patch fixes 78771, were an assert fires due to recursive
instantiation of an inheriting ctor.  Normally when a recursive
instantiation is needed, we've already constructed and registered the
declaration, so simply return it.  For ctors though we need to construct
the clones after we've instantiated the the master pattern (later in
instantiate_template_1).  Hence any recursive instantiation of a cloned
fn will barf, as we do.

Now, with an inherited ctor we have to deduce its exception spec and
deletedness (deduce_inheriting_ctor).  That's fine, until one gets the
perverse testcase here.  In figuring out what Middle ctor is needed by
Middle(0), we end up trying to instantiate Derived::Derived (int) to see
if Middle::Middle (Derived) is a viable candidate.

Hmm, that seems like where the problem is. We shouldn't try to instantiate the inheriting constructor until we've already chosen the base constructor; in the new model the inheriting constructor is just an implementation detail.

Jason


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