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); }
25 template <typename T, typename U>
29 T t = std::move (value ());
35 void test(Optional<const Foo, const Foo> o) { o.release_value(); }
54 // Will call F::F(const F&) w/ and w/o std::move. So it's redundant.
55 F f = std::move (constfref()); // { dg-warning "redundant move in initialization" }
57 // Will call Z::Z(const Z&&) w/ std::move, and Z::Z(const Z&) w/o.
58 // So it's not redundant.
59 Z z = std::move (constzref());