Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

join_view::iterator::operator-- is incorrectly constrained #606

Open
ericniebler opened this issue Jan 8, 2019 · 1 comment
Open

join_view::iterator::operator-- is incorrectly constrained #606

ericniebler opened this issue Jan 8, 2019 · 1 comment

Comments

@ericniebler
Copy link
Owner

ericniebler commented Jan 8, 2019

From the WD, join_view::iterator::operator-- is specified as:

constexpr iterator& operator--()
  requires ref_is_glvalue && BidirectionalRange<Base> &&
    BidirectionalRange<iter_reference_t<iterator_t<Base>>>;

14 Effects: Equivalent to:

if (outer_ == ranges::end(parent_->base_))
  inner_ = ranges::end(*--outer_);
while (inner_ == ranges::begin(*outer_))
  inner_ = ranges::end(*--outer_);
--inner_;
return *this;

The trouble is from the lines that do:

  inner_ = ranges::end(*--outer_);

Clearly this will only compile when *--outer returns a CommonRange, but nowhere is that requirement stated.

Proposed Resolution:

Change the synopsis of join_view::iterator in [range.join.iterator] as follows:

 constexpr iterator& operator--()
   requires ref_is_glvalue && BidirectionalRange<Base> &&
-    BidirectionalRange<iter_reference_t<iterator_t<Base>>>;
+    BidirectionalRange<iter_reference_t<iterator_t<Base>>> &&
+    CommonRange<iter_reference_t<iterator_t<Base>>>;
 
 constexpr iterator operator--(int)
   requires ref_is_glvalue && BidirectionalRange<Base> &&
-    BidirectionalRange<iter_reference_t<iterator_t<Base>>>;
+    BidirectionalRange<iter_reference_t<iterator_t<Base>>> &&
+    CommonRange<iter_reference_t<iterator_t<Base>>>;

Make a similar change to the declarations in [range.join.iterator]/14 and /15.

@CaseyCarter
Copy link
Collaborator

CaseyCarter commented Jan 8, 2019

Edited the PR to end the requires-clause with ; instead of &&, and duplicated the requirements for operator--(int).

CaseyCarter added a commit to CaseyCarter/cmcstl2 that referenced this issue Jan 8, 2019
CaseyCarter added a commit to CaseyCarter/cmcstl2 that referenced this issue Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants