Skip to content

Commit f63f6a0

Browse files
constructor test
1 parent e4e3d97 commit f63f6a0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

libcxx/test/libcxx/ranges/range.adaptors/range.concat/iterator.valueless_by_exception.pass.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,26 @@ int main() {
237237
"valueless by exception");
238238
}
239239
}
240+
241+
{
242+
//valueless by exception test constructor
243+
flag = false;
244+
Range<0> r1;
245+
Range<1> r2;
246+
247+
auto cv = std::views::concat(r1, r2);
248+
auto iter1 = cv.begin();
249+
auto iter2 = std::ranges::next(cv.begin(), 4);
250+
flag = true;
251+
try {
252+
iter1 = std::move(iter2);
253+
} catch (...) {
254+
TEST_LIBCPP_ASSERT_FAILURE(
255+
[&] {
256+
std::ranges::iterator_t<const decltype(cv)> it3(iter1);
257+
(void)it3;
258+
}(),
259+
"valueless by exception");
260+
}
261+
}
240262
}

0 commit comments

Comments
 (0)