Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/implicit-move4.C

raw
1 // PR c++/113853
2 // { dg-do compile { target c++20 } }
3
4 struct X {
5 X();
6 X(const X&);
7 X(X&&) = delete;
8 };
9
10 void
11 f1 ()
12 {
13 try {
14 ;
15 } catch (X x) {
16 throw x; // { dg-error "use of deleted function" }
17 }
18 }
19
20 void
21 f2 (X x)
22 try {
23 ;
24 } catch (...) {
25 throw x; // { dg-error "use of deleted function" }
26 }
27
28 void
29 f2b (X x)
30 try {
31 ;
32 } catch (...) {
33 {
34 throw x; // { dg-error "use of deleted function" }
35 }
36 }
37
38 void
39 f3 ()
40 try {
41 X x;
42 throw x; // { dg-error "use of deleted function" }
43 } catch (...) {
44 }
45
46 void
47 f3b ()
48 try {
49 {
50 X x;
51 throw x; // { dg-error "use of deleted function" }
52 }
53 } catch (...) {
54 }
55
56 void
57 f4 (X x)
58 try {
59 throw x;
60 } catch (...) {
61 }
62
63 void
64 f4b (X x)
65 try {
66 {
67 throw x;
68 }
69 } catch (...) {
70 }
71
72 void
73 f5 (X x)
74 {
75 void g (decltype(throw x, true)); // { dg-error "use of deleted function|expected" }
76 }
77
78 // The "expected" shouldn't be here, c++/113924.
79 void
80 f6 (X x, int = decltype(throw x, true){}) // { dg-error "use of deleted function|expected" }
81 {
82 }
83
84 void
85 f7 (X x)
86 {
87 [&] { throw x; };
88 }