Repository navigation
Expand file tree
/
Copy pathClassOperatorHandler2Test.expect
More file actions
146 lines (123 loc) · 2.44 KB
/
Copy pathClassOperatorHandler2Test.expect
File metadata and controls
146 lines (123 loc) · 2.44 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
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
#include <iostream>
void f(int &&)
{
std::operator<<(std::operator<<(std::cout, "hello"), "&&\n");
}
void f(int &)
{
std::operator<<(std::operator<<(std::operator<<(std::operator<<(std::cout, "bello"), "&\n"), "world"), "\n");
}
class Foo
{
public:
inline Foo(int x)
: mX{x}
{
}
using retType_23_5 = const int;
inline operator retType_23_5 () const
{
return this->mX;
}
inline Foo operator++(int)
{
Foo old = Foo(*this) /* NRVO variable */;
printf(" ======\n");
++this->mX;
printf(" ++++++\n");
return Foo(static_cast<Foo &&>(old));
}
inline Foo & operator++()
{
++this->mX;
return *this;
}
inline Foo operator--(int)
{
Foo old = Foo(*this) /* NRVO variable */;
printf(" ======\n");
--this->mX;
printf(" ++++++\n");
return Foo(static_cast<Foo &&>(old));
}
inline Foo & operator--()
{
--this->mX;
return *this;
}
inline int Get() const
{
return this->mX;
}
private:
int mX;
public:
// inline constexpr Foo(const Foo &) noexcept = default;
// inline constexpr Foo(Foo &&) noexcept = default;
};
int main()
{
class __lambda_60_5
{
public:
inline void operator()() const
{
int n = 10;
f(n);
f(42);
f(int{});
Foo f = Foo(1);
f.operator++();
f.operator++(0);
f.operator--();
f.operator--(0);
printf("%d\n", f.operator++(0));
printf("%d %d\n", f.operator++(0), 1);
printf("%d\n", f.operator--(0));
printf("%d %d\n", f.operator--(0), 1);
Foo * ff = &f;
printf("%d\n", ff->Get());
++ff;
ff++;
++++ff;
--ff;
ff--;
----ff;
printf("%d\n", f.Get());
}
using retType_60_5 = void (*)();
inline constexpr operator retType_60_5 () const noexcept
{
return __invoke;
};
private:
static inline void __invoke()
{
__lambda_60_5{}.operator()();
}
} __lambda_60_5{};
__lambda_60_5.operator()();
int n = 10;
f(n);
f(42);
f(int{});
Foo f = Foo(1);
f.operator++();
f.operator++(0);
f.operator--();
f.operator--(0);
printf("%d\n", f.operator++(0));
printf("%d %d\n", f.operator++(0), 1);
printf("%d\n", f.operator--(0));
printf("%d %d\n", f.operator--(0), 1);
Foo * ff = &f;
printf("%d\n", ff->Get());
++ff;
ff++;
++++ff;
--ff;
ff--;
----ff;
printf("%d\n", f.Get());
return 0;
}