[PATCH] Verify assign operator signatures.

Aaron Ballman aaron at aaronballman.com
Mon Dec 15 12:58:39 PST 2014


On Mon, Dec 15, 2014 at 3:22 PM, Samuel Benzaquen <sbenza at google.com> wrote:
> Hi alexfh,
>
> Warn when the return type of assign operators is not Class&.
>
> http://reviews.llvm.org/D6667
>
> Files:
>   clang-tidy/google/AssignOperatorSignatureCheck.cpp
>   clang-tidy/google/AssignOperatorSignatureCheck.h
>   clang-tidy/google/CMakeLists.txt
>   clang-tidy/google/GoogleTidyModule.cpp
>   test/clang-tidy/google-assign-operator.cpp
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/

+struct Deleted {
+  // We don't check the return value of deleted operators.
+  void operator=(const Deleted&) = delete;
+  void operator=(Deleted&&) = delete;
+};

What about private declarations without a definition? Eg)

class noncopyable {
  noncopyable(const noncopyable&);
  void operator=(const noncopyable&);
};

~Aaron



More information about the cfe-commits mailing list