C++: Further nontype template testcases.

This commit is contained in:
Matthew Gretton-Dann
2019-10-22 10:54:14 +01:00
parent 57cd9b3990
commit ca898d4be0
3 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
// semmle-extractor-options: --edg --trap_container=folder --edg --trap-compression=none
template<int x>
struct C { };
static const int one1 = 1, one2 = 1;
C<one1> c = C<one2>();
C<one1 + one2> e;
template<typename T, T X>
struct D { };
D<int, 2> a;
D<long, 2> b;
template<typename T, T* X>
struct E { };
E<int, nullptr> z;

View File

@@ -0,0 +1,10 @@
| test.cpp:3:8:3:8 | C<1> | file://:0:0:0:0 | int | test.cpp:5:25:5:25 | 1 |
| test.cpp:3:8:3:8 | C<2> | file://:0:0:0:0 | int | file://:0:0:0:0 | 2 |
| test.cpp:3:8:3:8 | C<x> | file://:0:0:0:0 | int | file://:0:0:0:0 | x |
| test.cpp:10:8:10:8 | D<T, X> | test.cpp:9:19:9:19 | T | file://:0:0:0:0 | X |
| test.cpp:10:8:10:8 | D<int, 2> | file://:0:0:0:0 | int | test.cpp:12:8:12:8 | 2 |
| test.cpp:10:8:10:8 | D<long, 2L> | file://:0:0:0:0 | long | file://:0:0:0:0 | 2 |
| test.cpp:16:8:16:8 | E<T, X> | file://:0:0:0:0 | T * | file://:0:0:0:0 | X |
| test.cpp:16:8:16:8 | E<T, X> | test.cpp:15:19:15:19 | T | file://:0:0:0:0 | X |
| test.cpp:16:8:16:8 | E<int, (int *)nullptr> | file://:0:0:0:0 | int | file://:0:0:0:0 | 0 |
| test.cpp:16:8:16:8 | E<int, (int *)nullptr> | file://:0:0:0:0 | int * | file://:0:0:0:0 | 0 |

View File

@@ -0,0 +1,4 @@
import cpp
from Declaration d
select d, d.getATemplateArgument(), d.getATemplateArgumentValue()