| 1 |
// Core Issue #1331 (const mismatch with defaulted copy constructor) |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
// If T2 (what would be the implicit declaration) has a parameter of |
| 5 |
// type const C&, the corresponding parameter of T1 may be of type C&. |
| 6 |
|
| 7 |
struct S |
| 8 |
{ |
| 9 |
S& operator=(S &) = default; |
| 10 |
}; |
| 11 |
|
| 12 |
struct T |
| 13 |
{ |
| 14 |
T& operator=(volatile T &) = default; // { dg-error "defaulted" "" { target c++17_down } } |
| 15 |
// { dg-warning "implicitly deleted" "" { target c++20 } .-1 } |
| 16 |
}; |
| 17 |
|
| 18 |
struct U |
| 19 |
{ |
| 20 |
U& operator=(const volatile U &) = default; // { dg-error "defaulted" "" { target c++17_down } } |
| 21 |
// { dg-warning "implicitly deleted" "" { target c++20 } .-1 } |
| 22 |
}; |
| 23 |
|
| 24 |
struct V |
| 25 |
{ |
| 26 |
V& operator=(const V &) = default; |
| 27 |
}; |