rjmccall added a comment.

In https://reviews.llvm.org/D44536#1051181, @ahatanak wrote:

> I see, so Sema::CheckCompletedCXXClass probably isn't the right place to call 
> DeclareImplicitDestructor as that could significantly increase the size of 
> the AST.


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.

That probably points to the solution here.  We've already emitted a warning 
that the code is doing a trivial deletion.  We should set a flag in the 
CXXDeleteExpr saying that the destructor is trivial, based on what we found in 
Sema, and in IRGen we should honor that flag before actually looking at the 
type.

For what it's worth, I believe this test case has undefined behavior: we're 
[i]allowed[/i] to treat it as a deletion of an incomplete type and not actually 
call the destructor, because that was true at the point where we type-checked 
the call.  Arguably we should just set a flag in the CXXDeleteExpr


Repository:
  rC Clang

https://reviews.llvm.org/D44536



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to