blob: c290585b18b22add004217cb8b558fc6bc056073 [file] [log] [blame]
// PR c++/89660
// { dg-do compile { target c++11 } }
// { dg-options "-Wredundant-move" }
// Define std::move.
namespace std {
template<typename _Tp>
struct remove_reference
{ typedef _Tp type; };
template<typename _Tp>
struct remove_reference<_Tp&>
{ typedef _Tp type; };
template<typename _Tp>
struct remove_reference<_Tp&&>
{ typedef _Tp type; };
template<typename _Tp>
constexpr typename std::remove_reference<_Tp>::type&&
move(_Tp&& __t) noexcept
{ return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
}
template <typename S> struct D {
template <typename T> D (D<T> x) : k(&x.foo ()) {}
S &foo ();
int *k;
};
D<int> bar ();
struct F {
D<int> baz () {
D<F> f = bar ();
return std::move (*reinterpret_cast<D<int> *> (&f)); // { dg-bogus "redundant move in return statement" }
}
};