1 // { dg-do compile { target c++11 } }
2 // { dg-options "-Wredundant-move" }
7 struct remove_reference
10 template<typename _Tp>
11 struct remove_reference<_Tp&>
12 { typedef _Tp type; };
14 template<typename _Tp>
15 struct remove_reference<_Tp&&>
16 { typedef _Tp type; };
18 template<typename _Tp>
19 constexpr typename std::remove_reference<_Tp>::type&&
20 move(_Tp&& __t) noexcept
21 { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
48 // Will use move even without std::move.
49 return std::move (t); // { dg-warning "redundant move in return statement" }
55 // t is const: will decay into copy.
62 // t is const: will decay into copy despite std::move, so it's redundant.
63 // We used to warn about this, but no longer since c++/87378.
64 // Now we warn again since c++/90428.
65 return std::move (t); // { dg-warning "redundant move" }
76 fn6 (T<int> t, bool b)
80 return std::move (t); // { dg-warning "redundant move in return statement" }
86 // Core 1579 means we'll get a move here.
93 // Core 1579 means we'll get a move here. Even without std::move.
94 return std::move (t); // { dg-warning "redundant move in return statement" }
100 // T is a reference and the move isn't redundant.
101 return std::move (t);
107 // T is a reference and the move isn't redundant.
108 return std::move (t);