This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11856] unsigned warning in template
- From: "tromey at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jan 2007 12:32:24 -0000
- Subject: [Bug c++/11856] unsigned warning in template
- References: <bug-11856-781@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #20 from tromey at gcc dot gnu dot org 2007-01-17 12:32 -------
> The particularity of such expressions is that they are constants.
I've thought about this a bit but I don't have a real conclusion.
I don't know why this warning was added in the first place... it seems
like perhaps it was to deal with comparisons against constants.
For instance comparing "unsigned < 0" or what have you. If this is the
case (and we'd have to dig a bit to find out) then that would seem to
argue against this approach.
My interest here is template-oriented... I consider it from a generic
programming point of view. I was trying to write a certain program
in the generic style, and one particular template instantiation yielded
a warning.
One possible idea would be an expression attriute of some kind:
__do_not_warn__ (val < 0)
I'm not extremely happy with this however.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11856