Skip to content

Commit 3f0ce98

Browse files
committed
C++: Add destructor test cases for AV Rule 114
1 parent eca6c00 commit 3f0ce98

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/AV Rule 114.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
| test.cpp:112:1:112:1 | return ... | Function g14 should return a value of type int but does not return a value here |
1111
| test.cpp:134:2:134:36 | ExprStmt | Function g16 should return a value of type int but does not return a value here |
1212
| test.cpp:141:3:141:37 | ExprStmt | Function g17 should return a value of type int but does not return a value here |
13+
| test.cpp:189:2:189:16 | ExprStmt | Function g23 should return a value of type int but does not return a value here |

cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/test.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,21 @@ int g19(int x)
170170
int g21() {
171171
g20(); // GOOD
172172
}
173+
174+
class Aborting {
175+
public:
176+
[[noreturn]]
177+
~Aborting();
178+
179+
void a() {};
180+
};
181+
182+
int g22() {
183+
Aborting x;
184+
185+
x.a(); // GOOD
186+
}
187+
188+
int g23() {
189+
Aborting().a(); // GOOD [FALSE POSITIVE]
190+
}

0 commit comments

Comments
 (0)