[PATCH] D45898: [SemaCXX] Mark destructor as referenced

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 17 22:02:53 PDT 2018


rjmccall added a comment.

I agree that the new-expression case doesn't use the destructor, and all the other cases of list-initialization presumably use the destructor for the initialized type for separate reasons.  Ok.



================
Comment at: test/CodeGenObjCXX/arc-list-init-destruct.mm:1
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -std=c++1z -fobjc-arc -fobjc-exceptions -fcxx-exceptions -fexceptions -emit-llvm -o - %s | FileCheck %s
+
----------------
ahatanak wrote:
> rjmccall wrote:
> > Does the corresponding C++ test case (replacing `Class0 *f;` with `HasExplicitNonTrivialDestructor f;`) not reproduce the problem?
> I wasn't able to reproduce the problem by changing the type of field 'f' to a C++ class with a non-trivial destructor because, if I make that change, Class1's destructor declaration gets added in Sema::AddImplicitlyDeclaredMembersToClass. I don't fully understand the reason behind it, but Class1's destructor declaration is added when the type of one of its subobject has a user-declared destructor.
Interesting, alright.


Repository:
  rC Clang

https://reviews.llvm.org/D45898





More information about the cfe-commits mailing list