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(const MyString&); |
| 11 MyString(MyString&&); |
| 12 }; |
| 13 |
| 14 template <class T> |
| 15 struct MyVector { |
| 16 MyVector(); |
| 17 MyVector(const MyVector&); |
| 18 MyVector(MyVector&&); |
| 19 }; |
| 20 |
| 21 // For now, this should only warn on the missing constructor, not on the missing |
| 22 // copy and move constructors on dllexported classes. |
| 23 class __declspec(dllexport) MissingCtorsArentOKInHeader { |
| 24 public: |
| 25 |
| 26 private: |
| 27 MyVector<int> one_; |
| 28 MyVector<MyString> two_; |
| 29 }; |
| 30 |
| 31 class __declspec(dllexport) InlineImplicitMoveCtorOK { |
| 32 public: |
| 33 InlineImplicitMoveCtorOK(); |
| 34 |
| 35 private: |
| 36 // ctor weight = 12, dtor weight = 9. |
| 37 MyString one_; |
| 38 MyString two_; |
| 39 MyString three_; |
| 40 int four_; |
| 41 int five_; |
| 42 int six_; |
| 43 }; |
| 44 |
| 45 class __declspec(dllexport) ExplicitlyDefaultedInlineAlsoWarns { |
| 46 public: |
| 47 ExplicitlyDefaultedInlineAlsoWarns() = default; |
| 48 ~ExplicitlyDefaultedInlineAlsoWarns() = default; |
| 49 ExplicitlyDefaultedInlineAlsoWarns( |
| 50 const ExplicitlyDefaultedInlineAlsoWarns&) = default; |
| 51 ExplicitlyDefaultedInlineAlsoWarns(ExplicitlyDefaultedInlineAlsoWarns&&) = |
| 52 default; |
| 53 |
| 54 private: |
| 55 MyVector<int> one_; |
| 56 MyVector<MyString> two_; |
| 57 |
| 58 }; |
| 59 |
| 60 #endif // MISSING_CTOR_H_ |
OLD | NEW |