CPP: 'if constexpr' test cases.

This commit is contained in:
Geoffrey White
2019-07-08 12:47:43 +01:00
parent 6a5ac08578
commit 42bf1be0fd

View File

@@ -56,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;
}