blob: f6c646e5a40e98ed04b7e98e82a0a5acea38810d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
struct B {};
struct D: B {};
void goodPlain() throw () {
try {
throw D();
} catch (B) {}
}
void goodReference() throw () {
try {
throw D();
} catch (B &) {}
}
void goodPointer() throw () {
D d;
try {
throw &d;
} catch (B *) {}
}
void badPlain() throw () { // expected-note {{non-throwing function declare here}}
try {
throw B(); // expected-warning {{'badPlain' has a non-throwing exception specification but can still throw, resulting in unexpected program termination}}
} catch (D) {}
}
void badReference() throw () { // expected-note {{non-throwing function declare here}}
try {
throw B(); // expected-warning {{'badReference' has a non-throwing exception specification but can still throw, resulting in unexpected program termination}}
} catch (D &) {}
}
void badPointer() throw () { // expected-note {{non-throwing function declare here}}
B b;
try {
throw &b; // expected-warning {{'badPointer' has a non-throwing exception specification but can still throw, resulting in unexpected program termination}}
} catch (D *) {}
}
|