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

view::generate isn't pipeable #276

Open
cjdb opened this issue Feb 2, 2019 · 3 comments
Open

view::generate isn't pipeable #276

cjdb opened this issue Feb 2, 2019 · 3 comments
Labels

Comments

@cjdb
Copy link
Collaborator

cjdb commented Feb 2, 2019

All the examples are ill-formed.

#include <experimental/ranges/range>

namespace view {
   using namespace std::experimental::ranges::view;
   using namespace std::experimental::ranges::view::ext;
} // namespace view

int main()
{
    auto s1 = view::generate([]{ return 0; }) | view::take(0);
    auto s2 = view::generate([]{ return 0; }) | view::take_while([](auto&&){ return true; });
    auto s3 = view::generate([]{ return 0; }) | view::filter([](auto&&){ return true; });
}
@cjdb
Copy link
Collaborator Author

cjdb commented Feb 2, 2019

The diagnostic is a bit too ugly for GitHub's confined spaces (see Compiler Explorer).

I've seen this issue crop up when functions haven't been SFINAEd out correctly: perhaps this could be something similar.

@melton1968
Copy link

melton1968 commented Feb 12, 2019

@cjdb: The code seems to be dancing around some gcc inconsistencies here. Using gcc-8.2.0 on OSX, the compilation fails without the -Wall flag, but succeeds with it. On Ubuntu gcc-8.1.0, it succeeds either way.

On Compiler Explorer:
gcc-trunk: fails
gcc-8.2: success (-Wall)
gcc-8.2: success (without -Wall)

On OSX:
gcc-8.2.0: success (-Wall)
gcc-8.2.0 fails (without -Wall)

On Ubuntu:
gcc-8.1.0: success (-Wall)
gcc-8.1.0: success (without -Wall)

cheers,
mark

@CaseyCarter
Copy link
Owner

Reduces to:

#include <stl2/view/generate.hpp>

int main() {
    auto r = __stl2::view::ext::generate([]{ return 0; });
    noexcept(__stl2::begin(r));
}

which nicely repros the "exception specification of begin depends on itself" issue on 8.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants