Skip to content

Commit ca898d4

Browse files
author
Matthew Gretton-Dann
committed
C++: Further nontype template testcases.
1 parent 57cd9b3 commit ca898d4

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// semmle-extractor-options: --edg --trap_container=folder --edg --trap-compression=none
2+
template<int x>
3+
struct C { };
4+
5+
static const int one1 = 1, one2 = 1;
6+
C<one1> c = C<one2>();
7+
C<one1 + one2> e;
8+
9+
template<typename T, T X>
10+
struct D { };
11+
12+
D<int, 2> a;
13+
D<long, 2> b;
14+
15+
template<typename T, T* X>
16+
struct E { };
17+
18+
E<int, nullptr> z;
19+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
| test.cpp:3:8:3:8 | C<1> | file://:0:0:0:0 | int | test.cpp:5:25:5:25 | 1 |
2+
| test.cpp:3:8:3:8 | C<2> | file://:0:0:0:0 | int | file://:0:0:0:0 | 2 |
3+
| test.cpp:3:8:3:8 | C<x> | file://:0:0:0:0 | int | file://:0:0:0:0 | x |
4+
| test.cpp:10:8:10:8 | D<T, X> | test.cpp:9:19:9:19 | T | file://:0:0:0:0 | X |
5+
| test.cpp:10:8:10:8 | D<int, 2> | file://:0:0:0:0 | int | test.cpp:12:8:12:8 | 2 |
6+
| test.cpp:10:8:10:8 | D<long, 2L> | file://:0:0:0:0 | long | file://:0:0:0:0 | 2 |
7+
| test.cpp:16:8:16:8 | E<T, X> | file://:0:0:0:0 | T * | file://:0:0:0:0 | X |
8+
| test.cpp:16:8:16:8 | E<T, X> | test.cpp:15:19:15:19 | T | file://:0:0:0:0 | X |
9+
| test.cpp:16:8:16:8 | E<int, (int *)nullptr> | file://:0:0:0:0 | int | file://:0:0:0:0 | 0 |
10+
| test.cpp:16:8:16:8 | E<int, (int *)nullptr> | file://:0:0:0:0 | int * | file://:0:0:0:0 | 0 |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import cpp
2+
3+
from Declaration d
4+
select d, d.getATemplateArgument(), d.getATemplateArgumentValue()

0 commit comments

Comments
 (0)