1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -Wself-move -std=c++11 -verify %s 2*0a6a1f1dSLionel Sambuc 3*0a6a1f1dSLionel Sambuc // definitions for std::move 4*0a6a1f1dSLionel Sambuc namespace std { 5*0a6a1f1dSLionel Sambuc inline namespace foo { 6*0a6a1f1dSLionel Sambuc template <class T> struct remove_reference { typedef T type; }; 7*0a6a1f1dSLionel Sambuc template <class T> struct remove_reference<T&> { typedef T type; }; 8*0a6a1f1dSLionel Sambuc template <class T> struct remove_reference<T&&> { typedef T type; }; 9*0a6a1f1dSLionel Sambuc 10*0a6a1f1dSLionel Sambuc template <class T> typename remove_reference<T>::type &&move(T &&t); 11*0a6a1f1dSLionel Sambuc } 12*0a6a1f1dSLionel Sambuc } 13*0a6a1f1dSLionel Sambuc int_test()14*0a6a1f1dSLionel Sambucvoid int_test() { 15*0a6a1f1dSLionel Sambuc int x = 5; 16*0a6a1f1dSLionel Sambuc x = std::move(x); // expected-warning{{explicitly moving}} 17*0a6a1f1dSLionel Sambuc (x) = std::move(x); // expected-warning{{explicitly moving}} 18*0a6a1f1dSLionel Sambuc 19*0a6a1f1dSLionel Sambuc using std::move; 20*0a6a1f1dSLionel Sambuc x = move(x); // expected-warning{{explicitly moving}} 21*0a6a1f1dSLionel Sambuc } 22*0a6a1f1dSLionel Sambuc 23*0a6a1f1dSLionel Sambuc int global; global_int_test()24*0a6a1f1dSLionel Sambucvoid global_int_test() { 25*0a6a1f1dSLionel Sambuc global = std::move(global); // expected-warning{{explicitly moving}} 26*0a6a1f1dSLionel Sambuc (global) = std::move(global); // expected-warning{{explicitly moving}} 27*0a6a1f1dSLionel Sambuc 28*0a6a1f1dSLionel Sambuc using std::move; 29*0a6a1f1dSLionel Sambuc global = move(global); // expected-warning{{explicitly moving}} 30*0a6a1f1dSLionel Sambuc } 31*0a6a1f1dSLionel Sambuc 32*0a6a1f1dSLionel Sambuc class field_test { 33*0a6a1f1dSLionel Sambuc int x; field_test(field_test && other)34*0a6a1f1dSLionel Sambuc field_test(field_test&& other) { 35*0a6a1f1dSLionel Sambuc x = std::move(x); // expected-warning{{explicitly moving}} 36*0a6a1f1dSLionel Sambuc x = std::move(other.x); 37*0a6a1f1dSLionel Sambuc other.x = std::move(x); 38*0a6a1f1dSLionel Sambuc other.x = std::move(other.x); // expected-warning{{explicitly moving}} 39*0a6a1f1dSLionel Sambuc } 40*0a6a1f1dSLionel Sambuc }; 41*0a6a1f1dSLionel Sambuc 42*0a6a1f1dSLionel Sambuc struct A {}; 43*0a6a1f1dSLionel Sambuc struct B { A a; }; CC44*0a6a1f1dSLionel Sambucstruct C { C() {}; ~C() {} }; struct_test()45*0a6a1f1dSLionel Sambucvoid struct_test() { 46*0a6a1f1dSLionel Sambuc A a; 47*0a6a1f1dSLionel Sambuc a = std::move(a); // expected-warning{{explicitly moving}} 48*0a6a1f1dSLionel Sambuc 49*0a6a1f1dSLionel Sambuc B b; 50*0a6a1f1dSLionel Sambuc b = std::move(b); // expected-warning{{explicitly moving}} 51*0a6a1f1dSLionel Sambuc b.a = std::move(b.a); // expected-warning{{explicitly moving}} 52*0a6a1f1dSLionel Sambuc 53*0a6a1f1dSLionel Sambuc C c; 54*0a6a1f1dSLionel Sambuc c = std::move(c); // expected-warning{{explicitly moving}} 55*0a6a1f1dSLionel Sambuc } 56