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

Reply via email to