https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119018
Bug ID: 119018
Summary: Some iota_view constructors are missing explicit
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: luigighiron at gmail dot com
Target Milestone: ---
libstdc++ does not correctly mark some of iota_view's constructors as explicit,
for example:
#include<ranges>
std::ranges::iota_view<int,int>foo(){
return{0,5};
}
This compiles fine using libstdc++, but is rejected when using libc++ or MSVC
STL. Here are the definitions of the iota_view constructors in libstdc++:
> iota_view() requires default_initializable<_Winc> = default;
>
> ...
>
> constexpr explicit
> iota_view(_Winc __value)
>
> ...
>
> constexpr
> iota_view(type_identity_t<_Winc> __value,
> type_identity_t<_Bound> __bound)
>
> ...
>
> constexpr
> iota_view(_Iterator __first, _Iterator __last)
> requires same_as<_Winc, _Bound>
>
> ...
>
> constexpr
> iota_view(_Iterator __first, unreachable_sentinel_t __last)
> requires same_as<_Bound, unreachable_sentinel_t>
>
> ...
>
> constexpr
> iota_view(_Iterator __first, _Sentinel __last)
> requires (!same_as<_Winc, _Bound>) && (!same_as<_Bound,
> unreachable_sentinel_t>)
>
> ...
Interestingly, the single argument constructor is marked explicit. All
constructors here except the first two should have explicit added.