Repository navigation
Expand file tree
/
Copy pathtest.cpp
More file actions
92 lines (88 loc) · 3.7 KB
/
Copy pathtest.cpp
File metadata and controls
92 lines (88 loc) · 3.7 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
struct s1 {
int m;
};
class C1 {};
typedef s1 s1_t;
typedef const s1 s1_const_t;
typedef C1 C1_t;
typedef const C1 C1_const_t;
void f() {
try {
} catch (int i) {
// COMPLIANT: Primitives will not be sliced when caught by value.
} catch (long l) {
// COMPLIANT: Primitives will not be sliced when caught by value.
} catch (float f) {
// COMPLIANT: Primitives will not be sliced when caught by value.
} catch (char c) {
// COMPLIANT: Primitives will not be sliced when caught by value.
} catch (int *p) {
// COMPLIANT: Pointers will not be sliced when caught by value.
} catch (s1 s) {
// NON-COMPLIANT: User-defined types will be sliced when caught by value.
} catch (const s1 s) {
// NON-COMPLIANT: User-defined types will be sliced when caught by value.
} catch (s1 *p) {
// COMPLIANT: Pointers will not be sliced when caught by value.
} catch (s1 *const p) {
// COMPLIANT: Pointers will not be sliced when caught by value.
} catch (s1 &r) {
// COMPLIANT: References will not be sliced when caught by value.
} catch (s1 &const r) {
// COMPLIANT: Const eferences will not be sliced when caught by value.
} catch (const C1 c) {
// NON-COMPLIANT: User-defined types will be sliced when caught by value.
} catch (C1 c) {
// NON-COMPLIANT: User-defined types will be sliced when caught by value.
} catch (C1 *p) {
// COMPLIANT: Pointers will not be sliced when caught by value.
} catch (C1 *const p) {
// COMPLIANT: Pointers will not be sliced when caught by value.
} catch (C1 &r) {
// COMPLIANT: References will not be sliced when caught by value.
} catch (C1 &const r) {
// COMPLIANT: Const eferences will not be sliced when caught by value.
} catch (s1_t s) {
// NON-COMPLIANT: User-defined types will be sliced when caught by value.
} catch (s1_const_t s) {
// NON-COMPLIANT: User-defined types will be sliced when caught by value.
} catch (C1_t c) {
// NON-COMPLIANT: User-defined types will be sliced when caught by value.
} catch (C1_const_t c) {
// NON-COMPLIANT: User-defined types will be sliced when caught by value.
} catch (s1_t *p) {
// COMPLIANT: Pointers will not be sliced when caught by value.
} catch (s1_t *const p) {
// COMPLIANT: Pointers will not be sliced when caught by value.
} catch (s1_t &r) {
// COMPLIANT: References will not be sliced when caught by value.
} catch (s1_t &const r) {
// COMPLIANT: Const eferences will not be sliced when caught by value.
} catch (C1_t *p) {
// COMPLIANT: Pointers will not be sliced when caught by value.
} catch (C1_t *const p) {
// COMPLIANT: Pointers will not be sliced when caught by value.
} catch (C1_t &r) {
// COMPLIANT: References will not be sliced when caught by value.
} catch (C1_t &const r) {
// COMPLIANT: Const eferences will not be sliced when caught by value.
} catch (s1_const_t *p) {
// COMPLIANT: Pointers will not be sliced when caught by value.
} catch (s1_const_t *const p) {
// COMPLIANT: Pointers will not be sliced when caught by value.
} catch (s1_const_t &r) {
// COMPLIANT: References will not be sliced when caught by value.
} catch (s1_const_t &const r) {
// COMPLIANT: Const eferences will not be sliced when caught by value.
} catch (C1_const_t *p) {
// COMPLIANT: Pointers will not be sliced when caught by value.
} catch (C1_const_t *const p) {
// COMPLIANT: Pointers will not be sliced when caught by value.
} catch (C1_const_t &r) {
// COMPLIANT: References will not be sliced when caught by value.
} catch (C1_const_t &const r) {
// COMPLIANT: Const eferences will not be sliced when caught by value.
} catch (...) {
// COMPLIANT: Catch-all handler.
}
}