public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100161] New: Impossible to suppress Wtype-limits warning involving template parameter.
@ 2021-04-20 18:50 yyc1992 at gmail dot com
  2021-04-20 19:06 ` [Bug c++/100161] [10/11/12 Regression] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: yyc1992 at gmail dot com @ 2021-04-20 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100161
           Summary: Impossible to suppress Wtype-limits warning involving
                    template parameter.
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yyc1992 at gmail dot com
  Target Milestone: ---

If a comparison involving a template parameter is always true or false, it
should not raise a warning if it could take other values for other template
parameters.

In particular, the type-limits warning from the code below,

```
void f(unsigned);

template<unsigned n>
void g()
{
    for (unsigned i = 0; i < n; i++) {
        f(i);
    }
}

void h()
{
    g<0>();
}
```

seems to be impossible to suppress. I think this is a regression around GCC 9
time. (I remember seeing it roughly around the same time/slightly after
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90728)

This is partially related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95148
(which would at least provide a way to suppress the warning).
Also somewhat related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81642
though supposedly the C++ template example given there is fixed.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-12-02 13:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 18:50 [Bug c++/100161] New: Impossible to suppress Wtype-limits warning involving template parameter yyc1992 at gmail dot com
2021-04-20 19:06 ` [Bug c++/100161] [10/11/12 Regression] " mpolacek at gcc dot gnu.org
2021-04-20 19:10 ` jakub at gcc dot gnu.org
2021-04-22 21:37 ` cvs-commit at gcc dot gnu.org
2021-04-22 21:38 ` [Bug c++/100161] [10/11 " mpolacek at gcc dot gnu.org
2021-04-27 16:41 ` cvs-commit at gcc dot gnu.org
2021-05-31 10:40 ` [Bug c++/100161] [10 " marxin at gcc dot gnu.org
2021-09-13 11:09 ` marxin at gcc dot gnu.org
2021-12-02 13:29 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).