C++: Add destructor test cases for AV Rule 114

This commit is contained in:
Jeroen Ketema
2024-03-22 10:22:59 +01:00
parent eca6c00003
commit 3f0ce98ccb
2 changed files with 19 additions and 0 deletions

View File

@@ -10,3 +10,4 @@
| test.cpp:112:1:112:1 | return ... | Function g14 should return a value of type int but does not return a value here |
| test.cpp:134:2:134:36 | ExprStmt | Function g16 should return a value of type int but does not return a value here |
| test.cpp:141:3:141:37 | ExprStmt | Function g17 should return a value of type int but does not return a value here |
| test.cpp:189:2:189:16 | ExprStmt | Function g23 should return a value of type int but does not return a value here |

View File

@@ -170,3 +170,21 @@ int g19(int x)
int g21() {
g20(); // GOOD
}
class Aborting {
public:
[[noreturn]]
~Aborting();
void a() {};
};
int g22() {
Aborting x;
x.a(); // GOOD
}
int g23() {
Aborting().a(); // GOOD [FALSE POSITIVE]
}