131
|
1 /* [depr.impldec] The implicit definition of a copy constructor as defaulted is
|
|
2 deprecated if the class has a user-declared copy assignment operator or a
|
|
3 user-declared destructor. The implicit definition of a copy assignment
|
|
4 operator as defaulted is deprecated if the class has a user-declared copy
|
|
5 constructor or a user-declared destructor (15.4, 15.8). In a future revision
|
|
6 of this International Standard, these implicit definitions could become
|
|
7 deleted (11.4). */
|
|
8
|
|
9 // { dg-additional-options -Wdeprecated-copy }
|
|
10
|
|
11 struct X
|
|
12 {
|
|
13 X();
|
|
14 X(const X&);
|
|
15 };
|
|
16 struct A
|
|
17 {
|
|
18 X x;
|
|
19 ~A();
|
|
20 };
|
|
21
|
|
22 void f(bool b)
|
|
23 {
|
|
24 A a;
|
|
25 if (b)
|
|
26 throw A(); // Don't warn about elided copy
|
|
27 A a2 = A(); // Here either.
|
|
28 A a3 (a); // { dg-warning "deprecated" "" { target c++11 } }
|
|
29 }
|