This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]