Skip to content

Commit 4698326

Browse files
author
Matthew Gretton-Dann
committed
C++: Add some simple non-type template tests
1 parent 4ab8729 commit 4698326

File tree

6 files changed

+21
-0
lines changed

6 files changed

+21
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
template <int i>
2+
class Int { };
3+
4+
Int<10> i;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| test.cpp:2:7:2:9 | Int<10> | file://:0:0:0:0 | int | test.cpp:4:5:4:6 | 10 |
2+
| test.cpp:2:7:2:9 | Int<i> | file://:0:0:0:0 | int | file://:0:0:0:0 | Unknown literal |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import cpp
2+
3+
from Class c
4+
select c, c.getATemplateArgument(), c.getATemplateArgumentValue()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// semmle-extractor-options: --edg --trap_container=folder --edg --trap-compression=none
2+
template <int i>
3+
int addToSelf() { return i + i; };
4+
5+
int bar() { return addToSelf<10>(); }
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| test.cpp:3:5:3:5 | addToSelf | file://:0:0:0:0 | int | test.cpp:5:30:5:31 | 10 |
2+
| test.cpp:3:5:3:13 | addToSelf | file://:0:0:0:0 | int | file://:0:0:0:0 | Unknown literal |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import cpp
2+
3+
from Function f
4+
select f, f.getATemplateArgument(), f.getATemplateArgumentValue()

0 commit comments

Comments
 (0)