https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96742
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- (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.