Skip to content

Commit 7c763cc

Browse files
committed
C++: Add a test for constexpr if
1 parent f705c25 commit 7c763cc

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
| test.cpp:3:17:13:1 | { ... } |
2+
| test.cpp:4:5:4:10 | declaration |
3+
| test.cpp:5:5:9:5 | if constexpr (...) ... |
4+
| test.cpp:5:25:7:5 | { ... } |
5+
| test.cpp:6:9:6:14 | ExprStmt |
6+
| test.cpp:7:12:9:5 | { ... } |
7+
| test.cpp:8:9:8:14 | ExprStmt |
8+
| test.cpp:10:5:12:5 | if constexpr (...) ... |
9+
| test.cpp:10:26:12:5 | { ... } |
10+
| test.cpp:11:9:11:14 | ExprStmt |
11+
| test.cpp:13:1:13:1 | return ... |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import cpp
2+
3+
from Stmt s
4+
select s
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// semmle-extractor-options: --edg --c++20
2+
3+
void test(void) {
4+
int x;
5+
if constexpr (true) {
6+
x = 1;
7+
} else {
8+
x = 2;
9+
}
10+
if constexpr (false) {
11+
x = 3;
12+
}
13+
}
14+

0 commit comments

Comments
 (0)