Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / Wredundant-move7.C
blob6547777c007d54ba9044bbd1d654577587107193
1 // PR c++/87378
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wredundant-move" }
5 // Define std::move.
6 namespace std {
7   template<typename _Tp>
8     struct remove_reference
9     { typedef _Tp   type; };
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 struct S1 { S1(S1 &&); };
26 struct S2 : S1 {};
29 f (S2 s)
31   return std::move(s); // { dg-warning "redundant move in return statement" }
34 struct R1 {
35   R1(R1 &&);
36   R1(const R1 &&);
38 struct R2 : R1 {};
41 f2 (const R2 s)
43   return std::move(s); // { dg-warning "redundant move in return statement" }
46 struct T1 {
47   T1(const T1 &);
48   T1(T1 &&);
49   T1(const T1 &&);
51 struct T2 : T1 {};
54 f3 (const T2 s)
56   // Without std::move: const T1 &
57   // With std::move: const T1 &&
58   return std::move(s); // { dg-warning "redundant move in return statement" }