[Bug c++/97544] -Wtype-limits triggered for comparison to template argument

2020-10-23 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97544

Marek Polacek  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|UNCONFIRMED |RESOLVED

--- Comment #5 from Marek Polacek  ---
Sorry, I'll make sure the warning is suppressed in this case.

*** This bug has been marked as a duplicate of bug 96742 ***

[Bug c++/97544] -Wtype-limits triggered for comparison to template argument

2020-10-23 Thread erenon2 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97544

--- Comment #4 from Benedek Thaler  ---
FTR, Using (N != 0 && i < N) does not silence the warning.
https://gcc.godbolt.org/z/WqaT3G

[Bug c++/97544] -Wtype-limits triggered for comparison to template argument

2020-10-23 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97544

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #3 from Marek Polacek  ---
So it's probably a dup of my bug 96742.

[Bug c++/97544] -Wtype-limits triggered for comparison to template argument

2020-10-23 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97544

--- Comment #2 from Jonathan Wakely  ---
It's right, but it's not helpful. There are other instantiations of the
template where the condition isn't always true, and users shouldn't have to
write the condition as (N != 0 && i < N) just to silence this warning.

G++ used to have loads of these warnings in templates, and most of them have
been suppressed because we've usually decided that it's not helpful to warn
about template code where some instantiations result in "always true"
comparisons.

[Bug c++/97544] -Wtype-limits triggered for comparison to template argument

2020-10-23 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97544

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
Why do you think the warning is wrong?