[libcxx-commits] [PATCH] D112631: [libc++][test] Fix invalid test for views::view_interface

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 27 11:10:01 PDT 2021


cjdb added a comment.

In D112631#3090888 <https://reviews.llvm.org/D112631#3090888>, @jloser wrote:

> In D112631#3090641 <https://reviews.llvm.org/D112631#3090641>, @cjdb wrote:
>
>> Nice catch, thanks.
>>
>> I think a conforming implementation is allowed to put those two requirements on each of the member functions: WDYT about adding that in this patch?
>
> Do you mind elaborating on your suggestion here? In `view.interface.general` note 2 states: that "`D shall be complete, and model both derived_­from<view_­interface<D>> and view`".  So, I'm assuming you're referring to the completeness and `view` requirements?  Note the requirement of completeness is dependent on where it's checked because `D` can be an incomplete type as it mentions in the note.

Ah, yes, I forgot about the completeness requirement, although I'm not really concerned about that one. All of our requirements hinge on completeness.

> I think an improvement in the QoI that may be a nice middle-ground is to put a `static_assert(view<_Derived>, "Derived class must be a view.");` in `view_interface`. However, this breaks several ranges tests - specifically, `subrange` which inherits from `view_interface`. I haven't looked too closely, but at the time of the inheritance, `subrange` wouldn't be a complete type, so we may have a bug somewhere with incompleteness of types and some view/range concepts somewhere. I'd recommend we investigate that in a follow-up. What do you think?

We can't do a static assert because the special member functions are allowed to exist. What I'm proposing is:

  constexpr bool empty() requires forward_­range<D> and view<D> and derived_from<D, view_interface<D>>;


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112631/new/

https://reviews.llvm.org/D112631



More information about the libcxx-commits mailing list