cmcstl2
cmcstl2 copied to clipboard
view::generate isn't pipeable
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; });
}
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.
@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
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.