[Bug c++/86228] ordered comparison between pointer and zero
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 10 10:16:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86228
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to eracpp from comment #2)
> This bug was observed in the following example:
>
> https://gcc.godbolt.org/z/p1VreP
>
> #include <algorithm>
> #include <array>
>
> int main()
> {
> std::array<int, 3> arr;
>
> // Mistake: meant to use std::generate.
> std::generate_n(arr.begin(), arr.end(), []{ return 0; });
> }
>
> This code successfully compiles (unexpectedly) with GCC due to `size > 0`
> being treated as well-formed in the case where the type of second parameter
> `size` is deduced to be a pointer type such as `int*`.
That's PR 87982
More information about the Gcc-bugs
mailing list