-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathtest.cpp
More file actions
70 lines (54 loc) · 839 Bytes
/
test.cpp
File metadata and controls
70 lines (54 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "typeinfo.h"
int test1() {
int x;
return sizeof(x); // unevaluated
}
int test2() {
int x;
return sizeof(x + 1); // unevaluated
}
class MyClass {
public:
int field;
};
void test3() {
MyClass my_class;
int x;
decltype(my_class.field) y = x; // unevaluated
}
void test4() {
int x;
noexcept(x); // unevaluated
}
void test5() {
int x;
typeid(x); // unevaluated
}
class NoVirtual {
public:
int x;
};
void test6() {
NoVirtual x;
typeid(*&x); // unevaluated
}
class Virtual {
public:
int x;
virtual int GetX();
};
void test7() {
Virtual x;
typeid(x); // evaluated
}
void test8() {
typeid(4); // unevaluated
}
Virtual getAVirtual();
void test9() {
typeid(getAVirtual()); // unevaluated
}
void constExprIf() {
if constexpr(sizeof(int) == 4) { } // unevaluated
}
// semmle-extractor-options: -std=c++20