Skip to content

Commit f9ec202

Browse files
committed
test: add another test case that fails
1 parent 84296f6 commit f9ec202

File tree

2 files changed

+29
-18
lines changed

2 files changed

+29
-18
lines changed

regression-tests/pure2-last-use.cpp2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ issue_857: type = {
9292
//f_inout(this); // FIXME Moves `this`.
9393
f_copy(a);
9494
}
95+
q: (move this) = {
96+
//m(); // FIXME Moves implicit `this`.
97+
n();
98+
}
9599
// FIXME
96100
//z: (move this, move that) = {
97101
///*f */ if true { f_copy(this); }

regression-tests/test-results/pure2-last-use.cpp

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@
1212
class issue_857;
1313

1414

15-
#line 113 "pure2-last-use.cpp2"
15+
#line 117 "pure2-last-use.cpp2"
1616
class issue_857_2;
1717

1818

19-
#line 118 "pure2-last-use.cpp2"
19+
#line 122 "pure2-last-use.cpp2"
2020
class issue_857_3;
2121

2222

23-
#line 123 "pure2-last-use.cpp2"
23+
#line 127 "pure2-last-use.cpp2"
2424
class issue_869;
2525

2626

27-
#line 167 "pure2-last-use.cpp2"
27+
#line 171 "pure2-last-use.cpp2"
2828
class cpp2_union;
2929

3030

31-
#line 175 "pure2-last-use.cpp2"
31+
#line 179 "pure2-last-use.cpp2"
3232
class my_string;
3333

3434

@@ -100,6 +100,9 @@ class issue_857 {
100100
public: auto p3() && -> void;
101101

102102
#line 95 "pure2-last-use.cpp2"
103+
public: auto q() && -> void;
104+
105+
#line 99 "pure2-last-use.cpp2"
103106
// FIXME
104107
//z: (move this, move that) = {
105108
///*f */ if true { f_copy(this); }
@@ -143,24 +146,24 @@ public: issue_869(issue_869&& that) noexcept;
143146
public: auto operator=(issue_869 const& that) -> issue_869& ;
144147
public: auto operator=(issue_869&& that) noexcept -> issue_869& ;
145148

146-
#line 125 "pure2-last-use.cpp2"
149+
#line 129 "pure2-last-use.cpp2"
147150
};
148151

149152
auto issue_884_3() -> void;
150153

151-
#line 137 "pure2-last-use.cpp2"
154+
#line 141 "pure2-last-use.cpp2"
152155
auto issue_884() -> void;
153156

154-
#line 146 "pure2-last-use.cpp2"
157+
#line 150 "pure2-last-use.cpp2"
155158
auto issue_884_2() -> void;
156159

157-
#line 155 "pure2-last-use.cpp2"
160+
#line 159 "pure2-last-use.cpp2"
158161
auto issue_888(std::string r, int size) -> void;
159162

160-
#line 161 "pure2-last-use.cpp2"
163+
#line 165 "pure2-last-use.cpp2"
161164
auto draw() -> void;
162165

163-
#line 167 "pure2-last-use.cpp2"
166+
#line 171 "pure2-last-use.cpp2"
164167
class cpp2_union {
165168
public: auto destroy() & -> void;
166169
public: ~cpp2_union() noexcept;
@@ -169,7 +172,7 @@ class cpp2_union {
169172
public: auto operator=(cpp2_union const&) -> void = delete;
170173

171174

172-
#line 173 "pure2-last-use.cpp2"
175+
#line 177 "pure2-last-use.cpp2"
173176
};
174177

175178
class my_string {
@@ -283,11 +286,15 @@ auto f_copy([[maybe_unused]] auto ...unnamed_param_1) -> void{}
283286
//f_inout(this); // FIXME Moves `this`.
284287
f_copy(std::move(*this).a);
285288
}
289+
auto issue_857::q() && -> void{
290+
//m(); // FIXME Moves implicit `this`.
291+
std::move(*this).n();
292+
}
286293

287-
#line 117 "pure2-last-use.cpp2"
294+
#line 121 "pure2-last-use.cpp2"
288295
int gi {0};
289296

290-
#line 120 "pure2-last-use.cpp2"
297+
#line 124 "pure2-last-use.cpp2"
291298
auto issue_857_3::f() && -> void { static_cast<void>(f_inout(std::move(*this).i)); }
292299

293300

@@ -328,7 +335,7 @@ issue_869::issue_869(issue_869 const& that)
328335
if (CPP2_UFCS(is_i)(std::move(that))) {set_i(CPP2_UFCS(i)(std::move(that)));}
329336
return *this;
330337
}
331-
#line 127 "pure2-last-use.cpp2"
338+
#line 131 "pure2-last-use.cpp2"
332339
auto issue_884_3() -> void{
333340
auto x {cpp2_new<int>(0)};
334341
if (true) {}
@@ -369,17 +376,17 @@ auto draw() -> void{
369376
static_cast<void>(CPP2_UFCS_MOVE(vertex)((std::move(pos))));
370377
}
371378

372-
#line 168 "pure2-last-use.cpp2"
379+
#line 172 "pure2-last-use.cpp2"
373380
auto cpp2_union::destroy() & -> void{}
374381
cpp2_union::~cpp2_union() noexcept{
375382
// destroy(); FIXME Discarding `this` still moves it here.
376383
static_cast<void>(std::move((*this)));
377384
}
378385

379-
#line 180 "pure2-last-use.cpp2"
386+
#line 184 "pure2-last-use.cpp2"
380387
auto main(int const argc_, char** argv_) -> int{
381388
auto const args = cpp2::make_args(argc_, argv_);
382-
#line 181 "pure2-last-use.cpp2"
389+
#line 185 "pure2-last-use.cpp2"
383390
issue_683(args);
384391
issue_847_2(std::vector<std::unique_ptr<int>>());
385392
}

0 commit comments

Comments
 (0)