g++ 2.96 -W issues bogus warning for conditional expression with enum and unsigned

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Thu Jul 6 00:14:00 GMT 2000


> the program below issues a warning when compiled with gcc -W. This new
> warning (it was not present in 2.95.2) disappears if the type of the
> third subexpression is int.
> 
> I don't see a reason for the warning in 5.16, p6.

Thanks for your bug report. The message you see is indeed not a
diagnostic message ([defns.diagnostic]); instead, I believe it is a
warning about a potential programming mistakes. It was introduced by

1999-09-02  Nathan Sidwell  <nathan@acm.org>

	* call.c (build_conditional_expr): Warn on enum mismatches.

so maybe Nathan can comment about the exact rationale for this
warning, and point to the exact place in the documentation where this
warning is documented.

> PS Also, the text of the warning is unnecessarily broken up into two
> lines.

That is not a bug; it's a feature. See the documentation of
-fmessage-length for details.

Regards,
Martin


More information about the Gcc-bugs mailing list