1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -fobjc-arc -verify -fblocks -Wpessimizing-move -Wredundant-move %s
3 // definitions for std::move
6 template <class T> struct remove_reference { typedef T type; };
7 template <class T> struct remove_reference<T&> { typedef T type; };
8 template <class T> struct remove_reference<T&&> { typedef T type; };
10 template <class T> typename remove_reference<T>::type &&move(T &&t);
17 MoveOnly(MoveOnly &&) = default; // expected-note 2 {{copy constructor is implicitly deleted}}
18 MoveOnly &operator=(MoveOnly &&) = default;
23 __block MoveOnly temp;
24 MoveOnly temp2 = temp; // expected-error {{call to implicitly-deleted copy constructor of 'MoveOnly'}}
25 MoveOnly temp3 = std::move(temp); // ok
28 MoveOnly errorOnCopy() {
29 __block MoveOnly temp;
30 return temp; // expected-error {{call to implicitly-deleted copy constructor of 'MoveOnly'}}
33 MoveOnly dontWarnOnMove() {
34 __block MoveOnly temp;
35 return std::move(temp); // ok
38 class MoveOnlySub : public MoveOnly {};
40 MoveOnly dontWarnOnMoveSubclass() {
41 __block MoveOnlySub temp;
42 return std::move(temp); // ok