22 lines · cpp
1// RUN: %check_clang_tidy %s cert-oop11-cpp %t2 3struct B {4 B(B&&) noexcept = default;5 6 B(const B &) = default;7 B& operator=(const B&) = default;8 ~B() {}9};10 11struct 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]15 D(D &&d) : b(d.b) {}16 17 // This should not produce a diagnostic because it is not covered under18 // the CERT guideline for OOP11-CPP. However, this will produce a diagnostic19 // under performance-move-constructor-init.20 D(B b) : b(b) {}21};22