Skip to content

Commit

Permalink
call test_LWG_3590
Browse files Browse the repository at this point in the history
  • Loading branch information
fsb4000 committed Dec 11, 2021
1 parent b17f568 commit 0ac79c3
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions tests/std/tests/P0896R4_views_split/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,20 +330,29 @@ constexpr bool test_devcom_1559808() {
}

struct CopyConstructibleRange {
constexpr CopyConstructibleRange(vector<int> v) : inner(move(v)) {}
CopyConstructibleRange(const CopyConstructibleRange&) = default;
CopyConstructibleRange& operator=(const CopyConstructibleRange&) = delete;
int* begin() const;
int* end() const;
constexpr const int* begin() const {
return inner.empty() ? nullptr : &inner[0];
}
constexpr const int* end() const {
return inner.empty() ? nullptr : (&inner[0] + inner.size());
}

vector<int> inner;
};

// COMPILE-ONLY
void testLWG3590(const CopyConstructibleRange& r) {
constexpr bool test_LWG_3590() {
CopyConstructibleRange r{{1, 2, 3, 4}};
auto split_view = views::split(r, 0);

STATIC_ASSERT(copy_constructible<CopyConstructibleRange>);
STATIC_ASSERT(!copyable<CopyConstructibleRange>);

[[maybe_unused]] auto base = split_view.base();
auto ref_view = split_view.base();

return ref_view.base().inner == r.inner;
}

int main() {
Expand All @@ -354,4 +363,7 @@ int main() {
STATIC_ASSERT(test_devcom_1559808());
#endif // TRANSITION, DevCom-1516290
test_devcom_1559808();

STATIC_ASSERT(test_LWG_3590());
assert(test_LWG_3590());
}

0 comments on commit 0ac79c3

Please sign in to comment.