[PATCH] D61165: Fix a crash where a [[no_destroy]] destructor was not emitted in an array

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 6 19:35:04 PDT 2019


rjmccall added a comment.

In D61165#1492780 <https://reviews.llvm.org/D61165#1492780>, @dexonsmith wrote:

> In D61165#1492724 <https://reviews.llvm.org/D61165#1492724>, @rjmccall wrote:
>
> > In D61165#1492582 <https://reviews.llvm.org/D61165#1492582>, @erik.pilkington wrote:
> >
> > > Duncan pointed out eel.is/c++draft/class.init#class.base.init-13, which appears to claim that initialization ends with the execution of the constructor, excluding temporary destructors.
> > >
> > > > (13) In a non-delegating constructor, initialization proceeds in the following order:
> > > >  /* list of steps... */
> > > >  (13.4) **Finally, the compound-statement of the constructor body is executed.**
> > >
> > > John: do you agree with this analysis?
> >
> >
> > That's talking about constructor bodies.
>
>
> Sure, but that's all that dcl.int suggests happens during initialization.  Skipping over paragraphs that don't apply:
>
> > http://eel.is/c++draft/dcl.init#17: The semantics of initializers are as follows.
> > 
> > - http://eel.is/c++draft/dcl.init#17.6: [I]f the destination type is a (possibly cv-qualified) class type:
> >   - http://eel.is/c++draft/dcl.init#17.6.2: [I]f the initialization is direct-initialization, or if it is copy-initialization where the cv-unqualified version of the source type is the same class as, or a derived class of, the class of the destination, constructors are considered. The applicable constructors are enumerated ([over.match.ctor]), and the best one is chosen through overload resolution ([over.match]). **Then:**
> >     - http://eel.is/c++draft/dcl.init#17.6.2.1: If overload resolution is successful, **the selected constructor is called to initialize the object**, with the initializer expression or expression-list as its argument(s).


We've been talking about two things in this thread:

1. We've talked about aggregate initialization, which is a kind of list-initialization, for which this paragraph does not apply.
2. We've talked about temporaries in the initializer, which are not part of the constructor body and are definitely not ordered before the destruction of subobjects within the constructor when an exception is thrown.

That's why I don't think that section is determinative.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61165/new/

https://reviews.llvm.org/D61165





More information about the cfe-commits mailing list