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

Hana Dusíková <hanicka at hanicka dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hanicka at hanicka dot net

--- Comment #7 from Hana Dusíková <hanicka at hanicka dot net> ---
(In reply to Jonathan Wakely from comment #4)
> (In reply to William Throwe from comment #2)
> > This warns if passed an array of length 0 because the for-loop condition is
> > always false.  Any change I can make to fix it seems to make the code worse.
> > I could replace "i < N" with "i + 1 < N + 1", but that certainly doesn't
> > make the code clearer (and in similar cases could lead to weird overflow
> > bugs).  I can't partially specialize the function, because that's not
> > allowed.  I could write an implementation struct and specialize that, but
> > that seems like massive overkill when the generic function works fine.
> 
> You can use N != 0 && i < N which doesn't have the overflow problem, but I
> agree it doesn't make the code clearer, and should not be necessary.

This is what I had in CTRE but it's also triggering same warning: 
https://compiler-explorer.com/z/fjY7sG

Reply via email to