mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Merge pull request #1563 from geoffw0/constexprif
CPP: Test cases for EmptyBlock.ql with 'if constexpr'
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
| empty_block.cpp:7:10:7:11 | { ... } | Empty block without comment |
|
||||
| empty_block.cpp:10:10:11:3 | { ... } | Empty block without comment |
|
||||
| empty_block.cpp:18:10:19:3 | { ... } | Empty block without comment |
|
||||
| empty_block.cpp:9:10:9:11 | { ... } | Empty block without comment |
|
||||
| empty_block.cpp:12:10:13:3 | { ... } | Empty block without comment |
|
||||
| empty_block.cpp:20:10:21:3 | { ... } | Empty block without comment |
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// semmle-extractor-options: -std=c++17
|
||||
|
||||
// GOOD:
|
||||
void f() {
|
||||
}
|
||||
@@ -54,4 +56,29 @@ int f(int x) {
|
||||
|
||||
// GOOD (has comment): [FALSE POSITIVE]
|
||||
if (x) {} // comment
|
||||
|
||||
// GOOD
|
||||
if (x) {
|
||||
if constexpr(1) {
|
||||
f();
|
||||
}
|
||||
}
|
||||
|
||||
// GOOD
|
||||
if (x) {
|
||||
if constexpr(0) {
|
||||
f();
|
||||
}
|
||||
}
|
||||
|
||||
// GOOD
|
||||
if (x) {
|
||||
if constexpr(1) {
|
||||
f();
|
||||
} else {
|
||||
f();
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user