[PATCH] D44536: Avoid segfault when destructor is not yet known

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 2 15:03:44 PDT 2018


rsmith added a comment.

In https://reviews.llvm.org/D44536#1051232, @rjmccall wrote:

> Right.  Again, I'd like Richard to weigh in here, but my suspicion would be that, somehow, the fact that e is an incomplete type when we type-check that call is combining poorly with the fact that it's declared by the time that we generate IR for it.  We probably do not record the existence of a pre-emptive use of the destructor.  There is no other way to get into this situation because every other thing that cares about the existence of a destructor requires a complete type.


Yes, that's exactly the situation. In all other cases, we can mark the destructor itself as used, and trigger synthesis / instantiation at that point, but if the class is incomplete, we don't have a destructor declaration to mark, and we can't even generate one. (That's not the only problem, though: there is state we store on the `CXXDeleteExpr`, such as the `OperatorDelete` and the sized delete flag, that we also need a complete class type in order to correctly generate.)


Repository:
  rC Clang

https://reviews.llvm.org/D44536





More information about the cfe-commits mailing list