OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MISSING_CTOR_H_ |
| 6 #define MISSING_CTOR_H_ |
| 7 |
| 8 struct MyString { |
| 9 MyString(); |
| 10 ~MyString(); |
| 11 MyString(const MyString&); |
| 12 MyString(MyString&&); |
| 13 }; |
| 14 |
| 15 template <class T> |
| 16 struct MyVector { |
| 17 MyVector(); |
| 18 ~MyVector(); |
| 19 MyVector(const MyVector&); |
| 20 MyVector(MyVector&&); |
| 21 }; |
| 22 |
| 23 // Note: this should warn for an implicit copy constructor too, but currently |
| 24 // doesn't, due to a plugin bug. |
| 25 class MissingCtorsArentOKInHeader { |
| 26 public: |
| 27 |
| 28 private: |
| 29 MyVector<int> one_; |
| 30 MyVector<MyString> two_; |
| 31 }; |
| 32 |
| 33 // Inline move ctors shouldn't be warned about. Similar to the previous test |
| 34 // case, this also incorrectly fails to warn for the implicit copy ctor. |
| 35 class InlineImplicitMoveCtorOK { |
| 36 public: |
| 37 InlineImplicitMoveCtorOK(); |
| 38 |
| 39 private: |
| 40 // ctor weight = 12, dtor weight = 9. |
| 41 MyString one_; |
| 42 MyString two_; |
| 43 MyString three_; |
| 44 int four_; |
| 45 int five_; |
| 46 int six_; |
| 47 }; |
| 48 |
| 49 class ExplicitlyDefaultedInlineAlsoWarns { |
| 50 public: |
| 51 ExplicitlyDefaultedInlineAlsoWarns() = default; |
| 52 ~ExplicitlyDefaultedInlineAlsoWarns() = default; |
| 53 ExplicitlyDefaultedInlineAlsoWarns( |
| 54 const ExplicitlyDefaultedInlineAlsoWarns&) = default; |
| 55 |
| 56 private: |
| 57 MyVector<int> one_; |
| 58 MyVector<MyString> two_; |
| 59 |
| 60 }; |
| 61 |
| 62 #endif // MISSING_CTOR_H_ |
OLD | NEW |