aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/CPlusPlusEleven.cpp
blob: 41821126ad8cd180d6c63a87bd3b27ab6f8751dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#include "Test.h"

namespace {
template <class T> T&& Move(T& o) { return static_cast<T&&>(o); }

class Moveable {
public:
    Moveable() {}
    Moveable(Moveable&&) {}
    Moveable& operator=(Moveable&&) { return *this; }
private:
    Moveable(const Moveable&);
    Moveable& operator=(const Moveable&);
};
} // namespace

DEF_TEST(CPlusPlusEleven_RvalueAndMove, r) {
    Moveable src1; Moveable dst1(Move(src1));
    Moveable src2, dst2; dst2 = Move(src2);
}