Skip to content

Commit 7d8396f

Browse files
committed
C++: Constant template pointer-to-member literals
1 parent d644150 commit 7d8396f

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

cpp/ql/src/semmle/code/cpp/internal/AddressConstantExpression.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ private predicate constantAddressLValue(Expr lvalue) {
3232
// tells us how it's going to be used.
3333
lvalue.(FunctionAccess).getType() instanceof RoutineType
3434
or
35+
// Pointer-to-member literals in uninstantiated templates
36+
lvalue instanceof Literal and
37+
not exists(lvalue.getValue()) and
38+
lvalue.isFromUninstantiatedTemplate(_)
39+
or
3540
// String literals have array types and undergo array-to-pointer conversion.
3641
lvalue instanceof StringLiteral
3742
or
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
| pointer_to_member__pmIsConstT | pointer_to_member.cpp:41:3:44:29 | declaration | pointer_to_member.cpp:44:11:44:28 | initializer for pms | Standard edge, only from QL | uninstantiated |
2-
| pointer_to_member__pmIsConstT | pointer_to_member.cpp:41:3:44:29 | declaration | pointer_to_member.cpp:45:1:45:1 | return ... | Standard edge, only from extractor | uninstantiated |
3-
| pointer_to_member__pmIsConstT | pointer_to_member.cpp:44:11:44:28 | initializer for pms | pointer_to_member.cpp:44:14:44:18 | Unknown literal | Standard edge, only from QL | uninstantiated |
4-
| pointer_to_member__pmIsConstT | pointer_to_member.cpp:44:11:44:28 | {...} | pointer_to_member.cpp:45:1:45:1 | return ... | Standard edge, only from QL | uninstantiated |
5-
| pointer_to_member__pmIsConstT | pointer_to_member.cpp:44:13:44:18 | & ... | pointer_to_member.cpp:44:22:44:26 | Unknown literal | Standard edge, only from QL | uninstantiated |
6-
| pointer_to_member__pmIsConstT | pointer_to_member.cpp:44:14:44:18 | Unknown literal | pointer_to_member.cpp:44:13:44:18 | & ... | Standard edge, only from QL | uninstantiated |
7-
| pointer_to_member__pmIsConstT | pointer_to_member.cpp:44:21:44:26 | & ... | pointer_to_member.cpp:44:11:44:28 | {...} | Standard edge, only from QL | uninstantiated |
8-
| pointer_to_member__pmIsConstT | pointer_to_member.cpp:44:22:44:26 | Unknown literal | pointer_to_member.cpp:44:21:44:26 | & ... | Standard edge, only from QL | uninstantiated |
91
| staticlocals__staticlocals_f2 | file://:0:0:0:0 | call to C | staticlocals.cpp:30:1:30:1 | return ... | Standard edge, only from QL | |
102
| staticlocals__staticlocals_f2 | file://:0:0:0:0 | initializer for c | file://:0:0:0:0 | call to C | Standard edge, only from QL | |
113
| staticlocals__staticlocals_f2 | staticlocals.cpp:29:5:29:17 | declaration | file://:0:0:0:0 | initializer for c | Standard edge, only from QL | |

0 commit comments

Comments
 (0)