every-enum.cpp
1.37 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Build with "cl.exe /Zi /GR- /GX- every-enum.cpp /link /debug /nodefaultlib /incremental:no /entry:main"
#include <stdint.h>
// clang-format off
void *__purecall = 0;
void __cdecl operator delete(void *,unsigned int) {}
void __cdecl operator delete(void *,unsigned __int64) {}
enum I8 : int8_t {
I8A = INT8_MIN,
I8B = 0,
I8C = INT8_MAX
};
enum I16 : int16_t {
I16A = INT16_MIN,
I16B = 0,
I16C = INT16_MAX,
};
enum I32 : int32_t {
I32A = INT32_MIN,
I32B = 0,
I32C = INT32_MAX,
};
enum I64 : int64_t {
I64A = INT64_MIN,
I64B = 0,
I64C = INT64_MAX,
};
enum U8 : uint8_t {
U8A = 0,
U8B = UINT8_MAX
};
enum U16 : uint16_t {
U16A = 0,
U16B = UINT16_MAX,
};
enum U32 : uint32_t {
U32A = 0,
U32B = UINT32_MAX,
};
enum U64 : uint64_t {
U64A = 0,
U64B = UINT64_MAX,
};
enum Char16 : char16_t {
C16A = u'a',
C16B = u'b',
};
enum Char32 : char32_t {
C32A = U'a',
C32B = U'b',
};
enum WChar : wchar_t {
WCA = L'a',
WCB = L'b',
};
enum Bool : bool {
BA = true,
BB = false
};
enum class EC {
A = 1,
B = 2
};
struct Struct {
enum Nested {
A = 1,
B = 2
};
};
template<typename T> void f(T t) {}
int main(int argc, char **argv) {
f(I8A);
f(I16A);
f(I32A);
f(I64A);
f(U8A);
f(U16A);
f(U32A);
f(U64A);
f(C16A);
f(C32A);
f(WCA);
f(BA);
f(EC::A);
f(Struct::A);
f<const volatile EC>(EC::A);
}