-
Notifications
You must be signed in to change notification settings - Fork 10.8k
/
main.cpp
145 lines (131 loc) · 4.29 KB
/
main.cpp
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
struct B { int dummy = 2324; };
struct C {
B b;
B* operator->() { return &b; }
int operator->*(int) { return 2; }
int operator+(int) { return 44; }
int operator+=(int) { return 42; }
int operator++(int) { return 123; }
int operator++() { return 1234; }
int operator-(int) { return 34; }
int operator-=(int) { return 32; }
int operator--() { return 321; }
int operator--(int) { return 4321; }
int operator*(int) { return 51; }
int operator*=(int) { return 52; }
int operator%(int) { return 53; }
int operator%=(int) { return 54; }
int operator/(int) { return 55; }
int operator/=(int) { return 56; }
int operator^(int) { return 57; }
int operator^=(int) { return 58; }
int operator|(int) { return 61; }
int operator|=(int) { return 62; }
int operator||(int) { return 63; }
int operator&(int) { return 64; }
int operator&=(int) { return 65; }
int operator&&(int) { return 66; }
int operator~() { return 71; }
int operator!() { return 72; }
int operator!=(int) { return 73; }
int operator=(int) { return 74; }
int operator==(int) { return 75; }
int operator<(int) { return 81; }
int operator<<(int) { return 82; }
int operator<=(int) { return 83; }
int operator<<=(int) { return 84; }
int operator>(int) { return 85; }
int operator>>(int) { return 86; }
int operator>=(int) { return 87; }
int operator>>=(int) { return 88; }
int operator()(int) { return 91; }
int operator[](int) { return 92; }
operator int() { return 11; }
operator long() { return 12; }
};
int main(int argc, char **argv) {
C c;
int result = c->dummy;
result = c->*4;
result += c+1;
result += c+=1;
result += c++;
result += ++c;
result += c-1;
result += c-=1;
result += c--;
result += --c;
result += c * 4;
result += c *= 4;
result += c % 4;
result += c %= 4;
result += c / 4;
result += c /= 4;
result += c ^ 4;
result += c ^= 4;
result += c | 4;
result += c |= 4;
result += c || 4;
result += c & 4;
result += c &= 4;
result += c && 4;
result += ~c;
result += !c;
result += c!=1;
result += c=2;
result += c==2;
result += c<2;
result += c<<2;
result += c<=2;
result += c<<=2;
result += c>2;
result += c>>2;
result += c>=2;
result += c>>=2;
result += c(1);
result += c[1];
result += static_cast<int>(c);
result += static_cast<long>(c);
//% self.expect("expr c->dummy", endstr=" 2324\n")
//% self.expect("expr c->*2", endstr=" 2\n")
//% self.expect("expr c + 44", endstr=" 44\n")
//% self.expect("expr c += 42", endstr=" 42\n")
//% self.expect("expr c++", endstr=" 123\n")
//% self.expect("expr ++c", endstr=" 1234\n")
//% self.expect("expr c - 34", endstr=" 34\n")
//% self.expect("expr c -= 32", endstr=" 32\n")
//% self.expect("expr c--", endstr=" 4321\n")
//% self.expect("expr --c", endstr=" 321\n")
//% self.expect("expr c * 3", endstr=" 51\n")
//% self.expect("expr c *= 3", endstr=" 52\n")
//% self.expect("expr c % 3", endstr=" 53\n")
//% self.expect("expr c %= 3", endstr=" 54\n")
//% self.expect("expr c / 3", endstr=" 55\n")
//% self.expect("expr c /= 3", endstr=" 56\n")
//% self.expect("expr c ^ 3", endstr=" 57\n")
//% self.expect("expr c ^= 3", endstr=" 58\n")
//% self.expect("expr c | 3", endstr=" 61\n")
//% self.expect("expr c |= 3", endstr=" 62\n")
//% self.expect("expr c || 3", endstr=" 63\n")
//% self.expect("expr c & 3", endstr=" 64\n")
//% self.expect("expr c &= 3", endstr=" 65\n")
//% self.expect("expr c && 3", endstr=" 66\n")
//% self.expect("expr ~c", endstr=" 71\n")
//% self.expect("expr !c", endstr=" 72\n")
//% self.expect("expr c!=1", endstr=" 73\n")
//% self.expect("expr c=1", endstr=" 74\n")
//% self.expect("expr c==1", endstr=" 75\n")
//% self.expect("expr c<1", endstr=" 81\n")
//% self.expect("expr c<<1", endstr=" 82\n")
//% self.expect("expr c<=1", endstr=" 83\n")
//% self.expect("expr c<<=1", endstr=" 84\n")
//% self.expect("expr c>1", endstr=" 85\n")
//% self.expect("expr c>>1", endstr=" 86\n")
//% self.expect("expr c>=1", endstr=" 87\n")
//% self.expect("expr c>>=1", endstr=" 88\n")
//% self.expect("expr c(1)", endstr=" 91\n")
//% self.expect("expr c[1]", endstr=" 92\n")
//% self.expect("expr static_cast<int>(c)", endstr=" 11\n")
//% self.expect("expr static_cast<long>(c)", endstr=" 12\n")
return 0;
}