This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/45553] Warning Suppression: C++ Templates, Unsigned, and "comparison of unsigned expression < 0 is always false"
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Sep 2010 06:33:51 -0000
- Subject: [Bug c++/45553] Warning Suppression: C++ Templates, Unsigned, and "comparison of unsigned expression < 0 is always false"
- References: <bug-45553-19613@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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