[PATCH] D68185: [Diagnostics] Warn when class implements a copy constructor/copy assignment operator, but missing the copy assignment operator/copy constructor

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 13:24:50 PDT 2019


dblaikie added a comment.

+1 for clang-tidy. GCC's closest to this is -Weffc++ which limits the rule of 3 warning to only "classes that have dynamic memory allocation" (though I'm not sure exactly what conditions it uses to decide that - it doesn't warn on anything in the test cases provided in this patch, it does warn if you add a dtor to Clz that deletes buf:
rule3.cpp:1:7: warning: ‘class Clz’ has pointer data members [-Weffc++]
 class Clz // expected-warning {{class implements custom copy assignment operator but missing custom copy constructor}}

  ^~~

rule3.cpp:1:7: warning:   but does not override ‘Clz(const Clz&)’ [-Weffc++]


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

https://reviews.llvm.org/D68185





More information about the cfe-commits mailing list