2
2
struct A_ShouldDiag {
3
3
~A_ShouldDiag (); // implicitly noexcept(true)
4
4
};
5
- A_ShouldDiag::~A_ShouldDiag () { // expected-note {{destructor or deallocator has a (possibly implicit) non-throwing excepton specification}}
6
- throw 1 ; // expected-warning {{has a non-throwing exception specification but can still throw, resulting in unexpected program termination }}
5
+ A_ShouldDiag::~A_ShouldDiag () { // expected-note {{destructor has a implicit non-throwing exception specification}}
6
+ throw 1 ; // expected-warning {{has a non-throwing exception specification but can still throw}}
7
7
}
8
8
struct B_ShouldDiag {
9
9
int i;
10
10
~B_ShouldDiag () noexcept (true ) {} // no disg, no throw stmt
11
11
};
12
12
struct R_ShouldDiag : A_ShouldDiag {
13
13
B_ShouldDiag b;
14
- ~R_ShouldDiag () { // expected-note {{destructor or deallocator has a}}
14
+ ~R_ShouldDiag () { // expected-note {{destructor has a implicit non-throwing exception specification }}
15
15
throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
16
16
}
17
17
};
@@ -30,18 +30,18 @@ struct N_ShouldDiag {
30
30
~N_ShouldDiag (); // implicitly noexcept(true)
31
31
};
32
32
33
- N_ShouldDiag::~N_ShouldDiag () { // expected-note {{destructor or deallocator has a}}
33
+ N_ShouldDiag::~N_ShouldDiag () { // expected-note {{destructor has a implicit non-throwing exception specification }}
34
34
throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
35
35
}
36
36
struct X_ShouldDiag {
37
37
B_ShouldDiag b;
38
- ~X_ShouldDiag () noexcept { // expected-note {{destructor or deallocator has a}}
39
- throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
38
+ ~X_ShouldDiag () noexcept { // expected-note {{destructor has a non-throwing exception }}
39
+ throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
40
40
}
41
41
};
42
42
struct Y_ShouldDiag : A_ShouldDiag {
43
- ~Y_ShouldDiag () noexcept (true ) { // expected-note {{destructor or deallocator has a}}
44
- throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
43
+ ~Y_ShouldDiag () noexcept (true ) { // expected-note {{destructor has a non-throwing exception specification }}
44
+ throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
45
45
}
46
46
};
47
47
struct C_ShouldNotDiag {
@@ -54,7 +54,7 @@ struct D_ShouldNotDiag {
54
54
throw 1 ;
55
55
}
56
56
};
57
- struct E_ShouldNotDiag {
57
+ struct E_ShouldNotDiag {
58
58
C_ShouldNotDiag c;
59
59
~E_ShouldNotDiag (); // implicitly noexcept(false)
60
60
};
@@ -68,7 +68,7 @@ class A1_ShouldDiag {
68
68
T b;
69
69
70
70
public:
71
- ~A1_ShouldDiag () { // expected-note {{destructor or deallocator has a}}
71
+ ~A1_ShouldDiag () { // expected-note {{destructor has a implicit non-throwing exception specification }}
72
72
throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
73
73
}
74
74
};
@@ -81,19 +81,19 @@ template <typename T>
81
81
struct R1_ShouldDiag : A1_ShouldDiag<T> // expected-note {{in instantiation of member function}}
82
82
{
83
83
B1_ShouldDiag<T> b;
84
- ~R1_ShouldDiag () { // expected-note {{destructor or deallocator has a}}
84
+ ~R1_ShouldDiag () { // expected-note {{destructor has a implicit non-throwing exception specification }}
85
85
throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
86
86
}
87
87
};
88
88
template <typename T>
89
89
struct S1_ShouldDiag : A1_ShouldDiag<T> {
90
90
B1_ShouldDiag<T> b;
91
- ~S1_ShouldDiag () noexcept { // expected-note {{destructor or deallocator has a}}
92
- throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
91
+ ~S1_ShouldDiag () noexcept { // expected-note {{destructor has a non-throwing exception specification }}
92
+ throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
93
93
}
94
94
};
95
- void operator delete (void *ptr) noexcept { // expected-note {{destructor or deallocator has a}}
96
- throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
95
+ void operator delete (void *ptr) noexcept { // expected-note {{deallocator has a non-throwing exception specification }}
96
+ throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
97
97
}
98
98
struct except_fun {
99
99
static const bool i = false ;
@@ -109,33 +109,33 @@ struct dependent_warn {
109
109
};
110
110
template <typename T>
111
111
struct dependent_warn_noexcept {
112
- ~dependent_warn_noexcept () noexcept (T::i) { // expected-note {{destructor or deallocator has a}}
113
- throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
112
+ ~dependent_warn_noexcept () noexcept (T::i) { // expected-note {{destructor has a non-throwing exception specification }}
113
+ throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
114
114
}
115
115
};
116
116
template <typename T>
117
117
struct dependent_warn_both {
118
- ~dependent_warn_both () noexcept (T::i) { // expected-note {{destructor or deallocator has a}}
119
- throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
118
+ ~dependent_warn_both () noexcept (T::i) { // expected-note {{destructor has a non-throwing exception specification }}
119
+ throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
120
120
}
121
121
};
122
- void foo () noexcept { // expected-note {{non-throwing function declare here}}
123
- throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
122
+ void foo () noexcept { // expected-note {{function declared non-throwing here}}
123
+ throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
124
124
}
125
125
struct Throws {
126
126
~Throws () noexcept (false );
127
127
};
128
128
129
129
struct ShouldDiagnose {
130
130
Throws T;
131
- ~ShouldDiagnose () noexcept { // expected-note {{destructor or deallocator has a}}
131
+ ~ShouldDiagnose () noexcept { // expected-note {{destructor has a non-throwing exception specification }}
132
132
throw ; // expected-warning {{has a non-throwing exception specification but}}
133
133
}
134
134
};
135
135
struct ShouldNotDiagnose {
136
136
Throws T;
137
- ~ShouldNotDiagnose () {
138
- throw ;
137
+ ~ShouldNotDiagnose () {
138
+ throw ;
139
139
}
140
140
};
141
141
@@ -158,37 +158,37 @@ void g_ShouldNotDiag() noexcept {
158
158
}
159
159
}
160
160
161
- void h_ShouldDiag () noexcept { // expected-note {{non-throwing function declare here}}
161
+ void h_ShouldDiag () noexcept { // expected-note {{function declared non-throwing here}}
162
162
try {
163
163
throw 12 ; // expected-warning {{has a non-throwing exception specification but}}
164
164
} catch (const char *) {
165
165
}
166
166
}
167
167
168
- void i_ShouldDiag () noexcept { // expected-note {{non-throwing function declare here}}
168
+ void i_ShouldDiag () noexcept { // expected-note {{function declared non-throwing here}}
169
169
try {
170
170
throw 12 ;
171
171
} catch (int ) {
172
172
throw ; // expected-warning {{has a non-throwing exception specification but}}
173
173
}
174
174
}
175
- void j_ShouldDiag () noexcept { // expected-note {{non-throwing function declare here}}
175
+ void j_ShouldDiag () noexcept { // expected-note {{function declared non-throwing here}}
176
176
try {
177
177
throw 12 ;
178
178
} catch (int ) {
179
179
throw " haha" ; // expected-warning {{has a non-throwing exception specification but}}
180
180
}
181
181
}
182
182
183
- void k_ShouldDiag () noexcept { // expected-note {{non-throwing function declare here}}
183
+ void k_ShouldDiag () noexcept { // expected-note {{function declared non-throwing here}}
184
184
try {
185
185
throw 12 ;
186
186
} catch (...) {
187
187
throw ; // expected-warning {{has a non-throwing exception specification but}}
188
188
}
189
189
}
190
190
191
- void loo_ShouldDiag (int i) noexcept { // expected-note {{non-throwing function declare here}}
191
+ void loo_ShouldDiag (int i) noexcept { // expected-note {{function declared non-throwing here}}
192
192
if (i)
193
193
try {
194
194
throw 12 ;
@@ -203,13 +203,13 @@ void loo1_ShouldNotDiag() noexcept {
203
203
throw 12 ;
204
204
}
205
205
206
- void loo2_ShouldDiag () noexcept { // expected-note {{non-throwing function declare here}}
206
+ void loo2_ShouldDiag () noexcept { // expected-note {{function declared non-throwing here}}
207
207
if (1 )
208
208
throw 12 ; // expected-warning {{has a non-throwing exception specification but}}
209
209
}
210
210
struct S {};
211
211
212
- void l_ShouldDiag () noexcept { // expected-note {{non-throwing function declare here}}
212
+ void l_ShouldDiag () noexcept { // expected-note {{function declared non-throwing here}}
213
213
try {
214
214
throw S{}; // expected-warning {{has a non-throwing exception specification but}}
215
215
} catch (S *s) {
@@ -222,7 +222,6 @@ void m_ShouldNotDiag() noexcept {
222
222
throw s;
223
223
} catch (S s) {
224
224
}
225
-
226
225
}
227
226
void n_ShouldNotDiag () noexcept {
228
227
try {
@@ -231,15 +230,15 @@ void n_ShouldNotDiag() noexcept {
231
230
} catch (const S &s) {
232
231
}
233
232
}
234
- void o_ShouldDiag () noexcept { // expected-note {{non-throwing function declare here}}
233
+ void o_ShouldDiag () noexcept { // expected-note {{function declared non-throwing here}}
235
234
try {
236
235
throw ; // expected-warning {{has a non-throwing exception specification but}}
237
236
} catch (...) {
238
237
}
239
238
}
240
239
241
240
#define NOEXCEPT noexcept
242
- void with_macro () NOEXCEPT { // expected-note {{non-throwing function declare here}}
241
+ void with_macro () NOEXCEPT { // expected-note {{function declared non-throwing here}}
243
242
throw 1 ; // expected-warning {{has a non-throwing exception specification but}}
244
243
}
245
244
@@ -248,8 +247,8 @@ void with_try_block() try {
248
247
} catch (...) {
249
248
}
250
249
251
- void with_try_block1 () noexcept try { // expected-note {{non-throwing function declare here}}
252
- throw 2 ; // expected-warning {{has a non-throwing exception specification but}}
250
+ void with_try_block1 () noexcept try { // expected-note {{function declared non-throwing here}}
251
+ throw 2 ; // expected-warning {{has a non-throwing exception specification but}}
253
252
} catch (char *) {
254
253
}
255
254
@@ -272,20 +271,20 @@ void goodPointer() noexcept {
272
271
throw &d;
273
272
} catch (B *) {}
274
273
}
275
- void badPlain () noexcept { // expected-note {{non-throwing function declare here}}
274
+ void badPlain () noexcept { // expected-note {{function declared non-throwing here}}
276
275
try {
277
- throw B (); // expected-warning {{'badPlain' has a non-throwing exception specification but can still throw, resulting in unexpected program termination }}
276
+ throw B (); // expected-warning {{'badPlain' has a non-throwing exception specification but can still throw}}
278
277
} catch (D) {}
279
278
}
280
- void badReference () noexcept { // expected-note {{non-throwing function declare here}}
279
+ void badReference () noexcept { // expected-note {{function declared non-throwing here}}
281
280
try {
282
- throw B (); // expected-warning {{'badReference' has a non-throwing exception specification but can still throw, resulting in unexpected program termination }}
281
+ throw B (); // expected-warning {{'badReference' has a non-throwing exception specification but can still throw}}
283
282
} catch (D &) {}
284
283
}
285
- void badPointer () noexcept { // expected-note {{non-throwing function declare here}}
284
+ void badPointer () noexcept { // expected-note {{function declared non-throwing here}}
286
285
B b;
287
286
try {
288
- throw &b; // expected-warning {{'badPointer' has a non-throwing exception specification but can still throw, resulting in unexpected program termination }}
287
+ throw &b; // expected-warning {{'badPointer' has a non-throwing exception specification but can still throw}}
289
288
} catch (D *) {}
290
289
}
291
290
}
0 commit comments