| 1 |
// PR c++/116162 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// Check that there is no -Wdefaulted-function-deleted for template |
| 4 |
// instantiations. |
| 5 |
|
| 6 |
template<typename> |
| 7 |
struct C { |
| 8 |
C(); |
| 9 |
C(const C&&) = default; // { dg-error "implicitly deleted" "" { target c++17_down} } |
| 10 |
}; |
| 11 |
|
| 12 |
struct D { |
| 13 |
D(const D&&) = default; // { dg-error "implicitly deleted" "" { target c++17_down} } |
| 14 |
// { dg-warning "implicitly deleted" "" { target c++20 } .-1 } |
| 15 |
}; |
| 16 |
|
| 17 |
struct M { |
| 18 |
M(); |
| 19 |
// So that W wouldn't have had "const W&" copy ctor if it were |
| 20 |
// implicitly declared. |
| 21 |
M(M&); |
| 22 |
}; |
| 23 |
|
| 24 |
struct W { |
| 25 |
W(); |
| 26 |
W(const W&) = default; // { dg-error "implicitly deleted" "" { target c++17_down} } |
| 27 |
// { dg-warning "implicitly deleted" "" { target c++20 } .-1 } |
| 28 |
M m; |
| 29 |
}; |
| 30 |
|
| 31 |
void |
| 32 |
g () |
| 33 |
{ |
| 34 |
C<int> c; |
| 35 |
} |