// PR c++/87029 // { dg-do compile { target c++11 } } // { dg-options "-Wredundant-move" } // Define std::move. namespace std { template struct remove_reference { typedef _Tp type; }; template struct remove_reference<_Tp&> { typedef _Tp type; }; template struct remove_reference<_Tp&&> { typedef _Tp type; }; template constexpr typename std::remove_reference<_Tp>::type&& move(_Tp&& __t) noexcept { return static_cast::type&&>(__t); } } struct T { }; struct U { U(T); }; template T fn1 (T t) { // Non-dependent type. return std::move (t); // { dg-warning "redundant move in return statement" } } template Tp1 fn2 (Tp2 t) { return std::move (t); } template Tp1 fn3 (Tp2 t) { return std::move (t); } int main () { T t; fn1(t); fn2(t); fn3(t); }