Skip to content

Commit fe575df

Browse files
committed
C++: Mark constexpr if as unevalauted.
1 parent 4e62dc8 commit fe575df

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ class Expr extends StmtParent, @expr {
307307
)
308308
or
309309
exists(Decltype d | d.getExpr() = this.getParentWithConversions*())
310+
or
311+
exists(ConstexprIfStmt constIf |
312+
constIf.getControllingExpr() = this.getParentWithConversions*()
313+
)
310314
}
311315

312316
/**

cpp/ql/test/library-tests/exprs/unevaluated/unevaluated.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@
1414
| test.cpp:57:9:57:9 | 4 |
1515
| test.cpp:63:9:63:19 | call to getAVirtual |
1616
| test.cpp:63:9:63:21 | temporary object |
17+
| test.cpp:67:16:67:26 | sizeof(int) |
18+
| test.cpp:67:16:67:31 | ... == ... |
19+
| test.cpp:67:31:67:31 | 4 |
20+
| test.cpp:67:31:67:31 | (unsigned long)... |

0 commit comments

Comments
 (0)