-
Notifications
You must be signed in to change notification settings - Fork 445
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
Error when using function return value directly #1813
Comments
This is intended behaviour Unfortunately, it looks like msvc doesn't print the helpful stuff that gcc or clang would in the error message:
And the referenced code section: template<typename Rng, typename ViewFn> // **************************
friend constexpr auto // **************************
operator|(Rng &&, view_closure<ViewFn> const &) // ******* READ THIS ********
// **** IF YOUR COMPILE *****
-> CPP_broken_friend_ret(Rng)( // ****** BREAKS HERE *******
requires range<Rng> && // **************************
(!viewable_range<Rng>)) = delete; // **************************
// * When piping a range into an adaptor, the range must satisfy the *
// * "viewable_range" concept. A range is viewable when either or both *
// * of these things are true: *
// * - The range is an lvalue (not a temporary object), OR *
// * - The range is a view (not a container). *
// ************************************************************************** See https://gcc.godbolt.org/z/s58o7bjqT
The issue with this code working would be where the rvalue vector would live, what would own it - views are lightweight and don't own containers like this (except cache1 AFAIK) so the filter view can't. Nothing can. As you've alluded to in your code snippet, and the above compile message says, a fix here is to use an lvalue instead |
version: 0.12.0
compiler: Visual Studio 2022 x64
code:
error logs:
The text was updated successfully, but these errors were encountered: