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

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 15 13:53:57 PDT 2018


rjmccall added a comment.

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

> Hmm.  Sema is lazy about actually creating implicit destructor declarations, but it's supposed to only do it whenever the destructor is actually used for something.  I suspect that Sema just thinks that nothing is using c::~c, because the only thing that does use it is d::~d, which is inline and has no apparent users.  But from the stack trace, it seems that IRGen is in fact emitting d::~d.  So the question is, why is IRGen emitting d::~d?  Because AFAIK a non-array new-expression never requires the destructor to exist.


Oh, because it's used in d's v-table, of course, which is needed by the implicit constructor for d.


Repository:
  rC Clang

https://reviews.llvm.org/D44536





More information about the cfe-commits mailing list