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

2021-12-18 Thread mikael.p.persson at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91780

--- Comment #10 from Mikael Persson  ---
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-bugzi...@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91780
>
> --- Comment #9 from Jonathan Wakely  ---
> 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 
> zip(Container_types&&... containers) -> zip;
>
> 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 and so
> z.containers_[0]->i is invalid.
>
> --
> You are receiving this mail because:
> You reported the bug.

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

2021-12-19 Thread mikael.p.persson at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91780

--- Comment #12 from Mikael Persson  ---
Looking at it now, not sure why i didnt.

On Sun, 19 Dec 2021, 14:00 redi at gcc dot gnu.org, <
gcc-bugzi...@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91780
>
> --- Comment #11 from Jonathan Wakely  ---
> Can't you just change your constructor to this?
>
> zip(Containers&&... containers) :
> containers_(std::forward(containers)...) { }
>
>
> The problematic deduction seems to only happen because of the odd
> constructor
> with an unused parameter pack that gets deduced as empty.
>
> --
> You are receiving this mail because:
> You reported the bug.

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

2021-12-19 Thread mikael.p.persson at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91780

--- Comment #13 from Mikael Persson  ---
Ah right lifetime

On Sun, 19 Dec 2021, 16:02 Mikael Persson, 
wrote:

> Looking at it now, not sure why i didnt.
>
> On Sun, 19 Dec 2021, 14:00 redi at gcc dot gnu.org, <
> gcc-bugzi...@gcc.gnu.org> wrote:
>
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91780
>>
>> --- Comment #11 from Jonathan Wakely  ---
>> Can't you just change your constructor to this?
>>
>> zip(Containers&&... containers) :
>> containers_(std::forward(containers)...) { }
>>
>>
>> The problematic deduction seems to only happen because of the odd
>> constructor
>> with an unused parameter pack that gets deduced as empty.
>>
>> --
>> You are receiving this mail because:
>> You reported the bug.
>
>