This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -Wextra and unsigned template parameters
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: Joe dot Buck at synopsys dot COM (Joe Buck)
- Cc: gdr at integrable-solutions dot net (Gabriel Dos Reis), agfinkel at yahoo dot com (Aliesha Finkel), gcc at gcc dot gnu dot org
- Date: Wed, 10 May 2006 12:30:33 -0400 (EDT)
- Subject: Re: -Wextra and unsigned template parameters
>
>
> Aliesha Finkel <agfinkel@yahoo.com> writes:
> > | Hi, I'm using -Wextra (-W) to compile my code, one
> > | feature of which is throwing a warning when an
> > | unsigned type is checked for >= 0 since it's always
> > | true. In general I find this to be very helpful, but
> > | it throws this error even for templated types...
> > |
> > | template <typename T>
> > | struct foo {
> > | foo(T bar) { if (bar >= 0) bar = 1; }
> > | };
>
> On Wed, May 10, 2006 at 01:38:29PM +0200, Gabriel Dos Reis wrote:
> > This is an issue as well for gcjx -- it can be annoying.
>
> I think that the warning is useful if the comparison is *always* true for
> any call of foo<anything>. But here, whether the test is redundant or not
> depends on the type of bar. Possibly there's a way to determine that the
> type of bar is a template argument and suppress the warning in that case.
Why are we talking so much in this thread and not fixing the bug?
Anyways this is PR 11856.
-- Pinski