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

<ranges>: operator|(_Left&& __l, _Right&& __r) should return decltype(auto) #4153

Closed
hewillk opened this issue Nov 8, 2023 · 1 comment · Fixed by #4211
Closed

<ranges>: operator|(_Left&& __l, _Right&& __r) should return decltype(auto) #4153

hewillk opened this issue Nov 8, 2023 · 1 comment · Fixed by #4211
Labels
bug Something isn't working fixed Something works now, yay! ranges C++20/23 ranges

Comments

@hewillk
Copy link
Contributor

hewillk commented Nov 8, 2023

STL/stl/inc/ranges

Lines 183 to 190 in bc5a5c3

_EXPORT_STD template <class _Left, class _Right>
requires (_Range_adaptor_closure_object<_Right> && range<_Left>)
_NODISCARD constexpr auto operator|(_Left&& __l, _Right&& __r) noexcept(
noexcept(_STD forward<_Right>(__r)(_STD forward<_Left>(__l))))
requires requires { static_cast<_Right&&>(__r)(static_cast<_Left&&>(__l)); }
{
return _STD forward<_Right>(__r)(_STD forward<_Left>(__l));
}

IIUC, LWG-3981 being tagged as NAD means it's a bug in MSVC-STL, right?

@StephanTLavavej StephanTLavavej added bug Something isn't working ranges C++20/23 ranges labels Nov 8, 2023
@StephanTLavavej
Copy link
Member

We talked about this at the weekly maintainer meeting and we agree that this is a bug - WG21-N4964 [range.adaptor.object]/1

For a range adaptor closure object C and an expression R such that decltype((R)) models range, the following expressions are equivalent:
C(R)
R | C

does indeed appear to clearly mandate that decltype(auto) is used here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Something works now, yay! ranges C++20/23 ranges
Projects
None yet
2 participants