[Bug libstdc++/100587] New: std::range::empty_view is not a view

gcc-bugs at marehr dot dialup.fu-berlin.de gcc-bugzilla@gcc.gnu.org
Thu May 13 13:43:26 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100587

            Bug ID: 100587
           Summary: std::range::empty_view is not a view
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-bugs at marehr dot dialup.fu-berlin.de
  Target Milestone: ---

The following snippet does not compile:

```c++
#include <ranges>

static_assert(std::ranges::view<std::ranges::empty_view<int>);
```

https://godbolt.org/z/3qanzdrb5

The standard says that https://eel.is/c++draft/range.empty#overview-1:

> empty_­view produces a view of no elements of a particular type.

empty_view is defined as inheriting from view_interface, the std::ranges::view
expects an inheritance from view_base per default.

Furthermore, https://eel.is/c++draft/ranges.syn does not specify 

> template<class T>
> inline constexpr bool enable_view<empty_view<T>> = true;

So I guess the standard is inconsistent here.


More information about the Gcc-bugs mailing list