| 1 |
// PR c++/109396 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "-Wall" } |
| 4 |
|
| 5 |
// Define std::move. |
| 6 |
namespace std { |
| 7 |
template<typename _Tp> |
| 8 |
struct remove_reference |
| 9 |
{ typedef _Tp type; }; |
| 10 |
|
| 11 |
template<typename _Tp> |
| 12 |
struct remove_reference<_Tp&> |
| 13 |
{ typedef _Tp type; }; |
| 14 |
|
| 15 |
template<typename _Tp> |
| 16 |
struct remove_reference<_Tp&&> |
| 17 |
{ typedef _Tp type; }; |
| 18 |
|
| 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); } |
| 23 |
} |
| 24 |
struct A { |
| 25 |
int i_; |
| 26 |
|
| 27 |
A(int) : i_(i_) { } // { dg-warning "itself" } |
| 28 |
A(int, int) : i_(this->i_) { } // { dg-warning "itself" } |
| 29 |
}; |
| 30 |
|
| 31 |
struct B { |
| 32 |
int i_; |
| 33 |
|
| 34 |
B(int) : i_(std::move(i_)) { } // { dg-warning "itself" } |
| 35 |
B(int, int) : i_(std::move(this->i_)) { } // { dg-warning "itself" } |
| 36 |
}; |
| 37 |
|