[Bug 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-12-20 Thread jakub at gcc dot gnu dot org


--- Comment #10 from jakub at gcc dot gnu dot org  2008-12-20 18:47 ---
Subject: Bug 36921

Author: jakub
Date: Sat Dec 20 18:46:12 2008
New Revision: 142849

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=142849
Log:
PR c++/36921
* c-common.c (warn_about_parentheses): Remove ARG_UNUSED from
arg_left.  Don't warn about X=Y=Z if comparison's type isn't
integral.

* g++.dg/warn/pr36921.C: New.

Added:
trunk/gcc/testsuite/g++.dg/warn/pr36921.C
Modified:
trunk/gcc/c-common.c
trunk/gcc/cp/ChangeLog
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug 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-12-03 Thread mmitchel at gcc dot gnu dot org


--- Comment #8 from mmitchel at gcc dot gnu dot org  2008-12-03 17:47 
---
I'm not convinced that we shouldn't warn in these cases.  Yes, there are cases
where people overload the operators in ways that make normal precedence
irrelevant.  But, there are also cases where people define boolean-like objects
that are not themselves bool.


-- 


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



[Bug 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-12-03 Thread deba at inf dot elte dot hu


--- Comment #9 from deba at inf dot elte dot hu  2008-12-03 19:26 ---
(In reply to comment #8)
 I'm not convinced that we shouldn't warn in these cases.  Yes, there are cases
 where people overload the operators in ways that make normal precedence
 irrelevant.  But, there are also cases where people define boolean-like 
 objects
 that are not themselves bool.
 
If the user-defined boolean-like object can be compared with other types, then
the user had to write such a comparison operator, therefore the user declared
that the boolean-like type is comparable with the other type. So this case
could not be a problem.

However, in my point of view, the proposed patch is not surely the best
solution. The C++ defined the bool, which could solve the (a  b  c) problem.
But unfortunately, as a shortcoming of the backward compatibility with C, the
bool type is convertible to numeric types, which is a quite wrong pitfall. I
think, instead of the current patch, the implicit conversion of a bool to
numeric value should be warned in C++.


-- 


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



[Bug 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 Thread manu at gcc dot gnu dot org


--- Comment #7 from manu at gcc dot gnu dot org  2008-10-25 14:53 ---
Patch and update summary.


-- 

manu at gcc dot gnu dot org changed:

   What|Removed |Added

URL||http://gcc.gnu.org/ml/gcc-
   ||patches/2008-
   ||10/msg01089.html
   Keywords||patch
Summary|[4.3/4.4 Regression]|[4.3/4.4 Regression] warning
   |comparison does not have|comparison does not have
   |mathematical meaning is not |mathematical meaning is not
   |correct |correct for overloaded
   ||operators that do not return
   ||boolean


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