------- 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

Reply via email to