mirror of
https://github.com/github/codeql.git
synced 2025-12-22 11:46:32 +01:00
C++: Add some simple non-type template tests
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
template <int i>
|
||||||
|
class Int { };
|
||||||
|
|
||||||
|
Int<10> i;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
| test.cpp:2:7:2:9 | Int<10> | file://:0:0:0:0 | int | test.cpp:4:5:4:6 | 10 |
|
||||||
|
| test.cpp:2:7:2:9 | Int<i> | file://:0:0:0:0 | int | file://:0:0:0:0 | Unknown literal |
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import cpp
|
||||||
|
|
||||||
|
from Class c
|
||||||
|
select c, c.getATemplateArgument(), c.getATemplateArgumentValue()
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
// semmle-extractor-options: --edg --trap_container=folder --edg --trap-compression=none
|
||||||
|
template <int i>
|
||||||
|
int addToSelf() { return i + i; };
|
||||||
|
|
||||||
|
int bar() { return addToSelf<10>(); }
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
| test.cpp:3:5:3:5 | addToSelf | file://:0:0:0:0 | int | test.cpp:5:30:5:31 | 10 |
|
||||||
|
| test.cpp:3:5:3:13 | addToSelf | file://:0:0:0:0 | int | file://:0:0:0:0 | Unknown literal |
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import cpp
|
||||||
|
|
||||||
|
from Function f
|
||||||
|
select f, f.getATemplateArgument(), f.getATemplateArgumentValue()
|
||||||
Reference in New Issue
Block a user