| 1 |
// PR c++/116162 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-additional-options "-Wno-defaulted-function-deleted" } |
| 4 |
|
| 5 |
struct M |
| 6 |
{ |
| 7 |
M& operator=(M&); |
| 8 |
}; |
| 9 |
|
| 10 |
struct T |
| 11 |
{ |
| 12 |
// if F1 is an assignment operator, and the return type of F1 differs |
| 13 |
// from the return type, the program is ill-formed. |
| 14 |
T operator=(T&) = default; // { dg-error "defaulted" } |
| 15 |
M m; |
| 16 |
}; |
| 17 |
|
| 18 |
struct U |
| 19 |
{ |
| 20 |
// if F1's non-object parameter type is not a reference, the program |
| 21 |
// is ill-formed. |
| 22 |
U& operator=(U) = default; // { dg-error "defaulted" } |
| 23 |
M m; |
| 24 |
}; |