| 1 |
// Positive test for defaulted/deleted fns |
| 2 |
// { dg-do run { target c++11 } } |
| 3 |
|
| 4 |
struct A |
| 5 |
{ |
| 6 |
int i; |
| 7 |
A() = default; |
| 8 |
A(const A&) = delete; |
| 9 |
A& operator=(const A&) = default; |
| 10 |
~A(); |
| 11 |
}; |
| 12 |
|
| 13 |
A::~A() = default; |
| 14 |
|
| 15 |
void f() = delete; |
| 16 |
|
| 17 |
struct B |
| 18 |
{ |
| 19 |
int i; |
| 20 |
B() = default; |
| 21 |
}; |
| 22 |
|
| 23 |
int main() |
| 24 |
{ |
| 25 |
A a1, a2; |
| 26 |
#if __cplusplus <= 201703L |
| 27 |
B b = {1}; |
| 28 |
#endif |
| 29 |
a1 = a2; |
| 30 |
} |
| 31 |
|
| 32 |
// fns defaulted in class defn are trivial |
| 33 |
struct C |
| 34 |
{ |
| 35 |
C() = default; |
| 36 |
C(const C&) = default; |
| 37 |
C& operator=(const C&) = default; |
| 38 |
~C() = default; |
| 39 |
}; |
| 40 |
|
| 41 |
union U |
| 42 |
{ |
| 43 |
C c; |
| 44 |
}; |