From 3f0ce98ccbcf677342b4a2de61db41986c1bb3a5 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Fri, 22 Mar 2024 10:22:59 +0100 Subject: [PATCH] C++: Add destructor test cases for AV Rule 114 --- .../AV Rule 114/AV Rule 114.expected | 1 + .../jsf/4.13 Functions/AV Rule 114/test.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/AV Rule 114.expected b/cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/AV Rule 114.expected index ce056261514a..390da977d3f3 100644 --- a/cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/AV Rule 114.expected +++ b/cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/AV Rule 114.expected @@ -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 | diff --git a/cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/test.cpp b/cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/test.cpp index c68ad23805cd..c19c5de13f90 100644 --- a/cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/test.cpp +++ b/cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/test.cpp @@ -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] +}