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

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 22 19:02:28 PDT 2018


ahatanak added a comment.

In https://reviews.llvm.org/D45898#1104025, @rsmith wrote:

> As it happens, the C++ committee fixed the language wording hole here very recently. The new rule can be found here: http://wg21.link/p0968r0#2227
>  In summary: we should to consider the destructor for all elements of the aggregate to be potentially-invoked.


It doesn't mean that clang should reject the following code, does it?

  // This should compile fine as long as 'Deleted7d d7d' is commented out.
  struct DeletedDtor { ~DeletedDtor() = delete; };
  struct Deleted7d { DeletedDtor a = {}; }; 
  //Deleted7d d7d;

I tried making a helper function out of the code in SK_UserConversion and using it in "case SK_ListInitialization". That doesn't seem to work because DiagnoseUseOfDecl rejects the code (with error message "error: attempt to use a deleted function") above even though the destructor isn't needed (because 'd7d' is commented out), so I guess that check should be done in another place.


Repository:
  rC Clang

https://reviews.llvm.org/D45898





More information about the cfe-commits mailing list