This is the mail archive of the gcc-bugs@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]

[Bug c++/45553] Warning Suppression: C++ Templates, Unsigned, and "comparison of unsigned expression < 0 is always false"



------- Comment #4 from jakub at gcc dot gnu dot org  2010-09-06 06:33 -------
In G++ 4.6+ you can do:
int i;
unsigned j;

template <class T>
void
bar (const T& t)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wtype-limits"
  if (t < 0)
#pragma GCC diagnostic pop
    {
      i++;
    }
}

void foo (void)
{
  bar (i);
  bar (j);
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45553


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