This is the mail archive of the gcc-patches@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: PR c++/36921 [4.3/4.4 Regression] warning "comparison does not have mathematical meaning" is not correct for overloaded operators that do not return boolean


2008/10/25 Jakub Jelinek <jakub@redhat.com>:
>
> Are you sure we don't want to warn even about the:
>  if (code == EQ_EXPR || code == NE_EXPR)
>    {
>      if (TREE_CODE_CLASS (code_left) == tcc_comparison
>          || TREE_CODE_CLASS (code_right) == tcc_comparison)
>        warning (OPT_Wparentheses,
>                 "suggest parentheses around comparison in operand of %s",
>                 code == EQ_EXPR ? "==" : "!=");
>    }
> case if EQ_EXPR or NE_EXPR don't return boolean?

Thanks. I added your suggestion. Bootstrapped and regression tested on
x86_64-unknown-linux-gnu with --enable-languages=all.

OK for trunk?

2008-11-04  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c++/36921
cp/
	* typeck.c (build_x_binary_op): Do not warn for overloaded
	comparison operators that do not return boolean.
testsuite/
	* g++.dg/warn/pr36921.C: New.

Attachment: fix-pr36921.diff
Description: Text document


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