[Bug c++/91780] Discrepancy between gcc 7.4, through 9.2, compared to clang.

mikael.p.persson at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Dec 19 07:54:42 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91780

--- Comment #10 from Mikael Persson <mikael.p.persson at gmail dot com> ---
Thats great.
Saw the dates on the other pr, jikes this has been around a while.

Testing
z.containers_[0]->i is clever, ill add a test for that ( or more generally
z.containers_[0]->begin(), static_assert if i can figure out how.

Is there a way to make the syntax for a zip iterator
for(auto& [a,b...] :zip(...))?  So
for(auto [a,...] : zip(...)) Would create local copies as expected?

As is i renamed it to zip::view, which seemed easier to read. ( And fixed a
bunch of other things too, but adding static assert clang only meant its
been practically unused. In particular as clang is still horrendously slow
for std::random compared to gcc. )


On Fri, 17 Dec 2021, 11:51 redi at gcc dot gnu.org, <
gcc-bugzilla@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91780
>
> --- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> GCC 10.1 isn't using the deduction guide at all, it seems to prefer to
> deduce
> the class type using the zip(Containers...) constructor, which deduces
> non-reference types.
>
> If I change the deduction guide to:
>
> template <typename... Container_types>
> zip(Container_types&&... containers) -> zip<int>;
>
> Then GCC 10.1 still compiles it, because it doesn't use that guide anyway.
> Whereas GCC 10.2 gives an error, because it does deduce as zip<int> and so
> z.containers_[0]->i is invalid.
>
> --
> You are receiving this mail because:
> You reported the bug.


More information about the Gcc-bugs mailing list