xref: /llvm-project/clang-tools-extra/test/clang-tidy/checkers/cert/oop54-cpp.cpp (revision 89a1d03e2b379e325daa5249411e414bbd995b5e)
1 // RUN: %check_clang_tidy %s cert-oop54-cpp %t
2 
3 // Test whether bugprone-unhandled-self-assignment.WarnOnlyIfThisHasSuspiciousField option is set correctly.
4 class TrivialFields {
5 public:
operator =(const TrivialFields & object)6   TrivialFields &operator=(const TrivialFields &object) {
7     // CHECK-MESSAGES: [[@LINE-1]]:18: warning: operator=() does not handle self-assignment properly [cert-oop54-cpp]
8     return *this;
9   }
10 
11 private:
12   int m;
13   float f;
14   double d;
15   bool b;
16 };
17