• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %check_clang_tidy %s cert-oop11-cpp %t
2 
3 struct B {
4   B(B&&) noexcept = default;
5 
6   B(const B &) = default;
7   B& operator=(const B&) = default;
~BB8   ~B() {}
9 };
10 
11 struct D {
12   B b;
13 
14   // CHECK-MESSAGES: :[[@LINE+1]]:14: warning: move constructor initializes class member by calling a copy constructor [cert-oop11-cpp]
DD15   D(D &&d) : b(d.b) {}
16 
17   // This should not produce a diagnostic because it is not covered under
18   // the CERT guideline for OOP11-CPP. However, this will produce a diagnostic
19   // under performance-move-constructor-init.
DD20   D(B b) : b(b) {}
21 };
22