halcanary | 3a6672a | 2015-02-13 15:12:52 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | #include "Test.h" |
bungeman | a3434d8 | 2015-09-07 12:45:52 -0700 | [diff] [blame] | 8 | #include "SkTemplates.h" |
halcanary | 3a6672a | 2015-02-13 15:12:52 -0800 | [diff] [blame] | 9 | |
| 10 | namespace { |
halcanary | 3a6672a | 2015-02-13 15:12:52 -0800 | [diff] [blame] | 11 | class Moveable { |
| 12 | public: |
| 13 | Moveable() {} |
| 14 | Moveable(Moveable&&) {} |
| 15 | Moveable& operator=(Moveable&&) { return *this; } |
| 16 | private: |
| 17 | Moveable(const Moveable&); |
| 18 | Moveable& operator=(const Moveable&); |
| 19 | }; |
bungeman | a3434d8 | 2015-09-07 12:45:52 -0700 | [diff] [blame] | 20 | template <typename T> void deleter(T*) { } |
| 21 | template <typename T> struct Deleter { |
| 22 | void operator()(T* t) { delete static_cast<const Moveable*>(t); } |
| 23 | }; |
halcanary | 3a6672a | 2015-02-13 15:12:52 -0800 | [diff] [blame] | 24 | } // namespace |
| 25 | |
| 26 | DEF_TEST(CPlusPlusEleven_RvalueAndMove, r) { |
bungeman | a3434d8 | 2015-09-07 12:45:52 -0700 | [diff] [blame] | 27 | Moveable src1; Moveable dst1(skstd::move(src1)); |
| 28 | Moveable src2, dst2; dst2 = skstd::move(src2); |
| 29 | } |