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

            Bug ID: 109024
           Summary: [C++23][ranges][repeat_view] The default ctor
                    unuseable
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yronglin777 at gmail dot com
  Target Milestone: ---

The default ctor of std::ranges::repeat_view<int> was unuseable.

https://godbolt.org/z/jxKMxEn7E

[P2474R2] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2474r2.html
```
repeat_view() requires default_initializable<W> = default;
```

```
#include <ranges>
#include <cassert>

void fn() {
    std::ranges::repeat_view<int> v;
}
```

```
In file included from <source>:1:
/opt/compiler-explorer/gcc-trunk-20230304/include/c++/13.0.1/ranges: In
instantiation of 'constexpr std::ranges::repeat_view<_Tp,
_Bound>::repeat_view() requires  default_initializable<_Tp> [with _Tp = int;
_Bound = std::unreachable_sentinel_t]':
<source>:5:35:   required from here
/opt/compiler-explorer/gcc-trunk-20230304/include/c++/13.0.1/ranges:7395:37:
error: could not convert '0' from 'int' to 'std::ranges::__detail::__box<int>'
 7395 |     __detail::__box<_Tp> _M_value = _Tp();
      |                                     ^~~~~
      |                                     |
      |                                     int
Compiler returned: 1
```

Reply via email to