[PATCH] D150411: [NFC][Clang][Coverity] Fix Static Code Analysis Concerns with copy without assign

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 22 18:20:51 PDT 2023


dblaikie added a comment.

(& I realize I'm a bit late to the party, but:

> In several cases it's not completely obvious to me whether a copy assignment operator should or can be defined. But perhaps this doesn't need to be addressed right now: we seem to compile with -Wextra, which contains -Wdeprecated-copy. That should warn if a compiler-generated copy operation is used while another is user-declared.



> The rules for when the copy vs assignment operators are implicitly defined as deleted can be hard to remember. I think being explicit is useful if only to indicate that the author thought about whether such operations should be provided. Since we don't have a principled reason for defining these operations as deleted, it might not be a bad idea to add a comment that states something like "The copy/move assignment operator is defined as deleted pending further motivation".

I'd also vote in favor of the "let it be implicitly deleted - we have the warnings enabled to catch it". But don't feel strongly enough to argue that chunks of this patch should be reverted)



================
Comment at: clang/lib/Sema/SemaAccess.cpp:207
+
+    // The copy constrcutor and copy assignment operator is defined as deleted
+    // pending further motivation.
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150411/new/

https://reviews.llvm.org/D150411



More information about the cfe-commits mailing list