2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wredundant-move" }
8 struct remove_reference
11 template<typename _Tp>
12 struct remove_reference<_Tp&>
13 { typedef _Tp type; };
15 template<typename _Tp>
16 struct remove_reference<_Tp&&>
17 { typedef _Tp type; };
19 template<typename _Tp>
20 constexpr typename std::remove_reference<_Tp>::type&&
21 move(_Tp&& __t) noexcept
22 { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
47 // Will use move even without std::move.
48 return std::move (t); // { dg-warning "redundant move in return statement" }
54 // t is const: will decay into copy.
61 // t is const: will decay into copy despite std::move, so it's redundant.
62 return std::move (t); // { dg-warning "redundant move in return statement" }
77 return std::move (t); // { dg-warning "redundant move in return statement" }
83 // Core 1579 means we'll get a move here.
90 // Core 1579 means we'll get a move here. Even without std::move.
91 return std::move (t); // { dg-warning "redundant move in return statement" }
97 // T is a reference and the move isn't redundant.
104 // T is a reference and the move isn't redundant.
105 return std::move (t);