Skip to content

Commit 42bf1be

Browse files
committed
CPP: 'if constexpr' test cases.
1 parent 6a5ac08 commit 42bf1be

File tree

1 file changed

+25
-0
lines changed
  • cpp/ql/test/query-tests/Best Practices/Likely Errors/EmptyBlock

1 file changed

+25
-0
lines changed

cpp/ql/test/query-tests/Best Practices/Likely Errors/EmptyBlock/empty_block.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,29 @@ int f(int x) {
5656

5757
// GOOD (has comment): [FALSE POSITIVE]
5858
if (x) {} // comment
59+
60+
// GOOD
61+
if (x) {
62+
if constexpr(1) {
63+
f();
64+
}
65+
}
66+
67+
// GOOD
68+
if (x) {
69+
if constexpr(0) {
70+
f();
71+
}
72+
}
73+
74+
// GOOD
75+
if (x) {
76+
if constexpr(1) {
77+
f();
78+
} else {
79+
f();
80+
}
81+
}
82+
83+
return 1;
5984
}

0 commit comments

Comments
 (0)