From 5b26a426dc06805fb93d9175a388472f9be8b975 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Thu, 3 Jul 2025 16:28:52 +0200 Subject: [PATCH] C++: Add test showing we miss the operands of postfix crement in dataflow --- cpp/ql/test/library-tests/dataflow/asExpr/test.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cpp/ql/test/library-tests/dataflow/asExpr/test.cpp b/cpp/ql/test/library-tests/dataflow/asExpr/test.cpp index fc9a4e6be082..859271087fbc 100644 --- a/cpp/ql/test/library-tests/dataflow/asExpr/test.cpp +++ b/cpp/ql/test/library-tests/dataflow/asExpr/test.cpp @@ -37,4 +37,13 @@ void test_aggregate_literal() { int xs[] = {1, 2, 3}; // $ asExpr=1 asExpr=2 asExpr=3 asExpr={...} const int ys[] = {[0] = 4, [1] = 5, [0] = 6}; // $ asExpr=4 asExpr=5 asExpr=6 asExpr={...} -} \ No newline at end of file +} + +void test_postfix_crement(int *p, int q) { + p++; // $ asExpr="... ++" asIndirectExpr="... ++" asExpr=p asIndirectExpr=p + q++; // $ asExpr="... ++" asExpr=q + (void)(p++); // $ numberOfNodes="... ++: 2" asExpr="... ++" numberOfIndirectNodes="... ++: 2" asIndirectExpr="... ++" MISSING: asExpr=p asIndirectExpr=p + (void)(q++); // $ numberOfNodes="... ++: 2" asExpr="... ++" MISSING: asExpr=q + int *p1 = p++; // $ asExpr="... ++" asIndirectExpr="... ++" asExpr="p(... ++)" asIndirectExpr="p(*... ++)" + int q1 = q++; // $ asExpr="... ++" asExpr="q(... ++)" +}