[Bug c++/36921] comparsion does not have mathematical meaning is not correct

2008-07-25 Thread deba at inf dot elte dot hu


--- Comment #4 from deba at inf dot elte dot hu  2008-07-25 14:43 ---
(In reply to comment #3)
> What Andrew means by "example" is a short, self-contained, compilable testcase
> that shows the undesired behaviour.
> 

struct A {};
A operator<(A, A) { return A(); }

int main() {
A() < A() < A(); // should not emit warning
1 < 2 < 3; // should emit warning
return 0;
}


-- 


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



[Bug c++/36921] comparsion does not have mathematical meaning is not correct

2008-07-25 Thread manu at gcc dot gnu dot org


--- Comment #3 from manu at gcc dot gnu dot org  2008-07-25 14:34 ---
What Andrew means by "example" is a short, self-contained, compilable testcase
that shows the undesired behaviour.


-- 

manu at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||manu at gcc dot gnu dot org


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



[Bug c++/36921] comparsion does not have mathematical meaning is not correct

2008-07-25 Thread deba at inf dot elte dot hu


--- Comment #2 from deba at inf dot elte dot hu  2008-07-25 10:24 ---
(In reply to comment #1)
> Example?
> 

In the LEMON graph library  (http://lemon.cs.elte.hu/) there is an LP solver
interface. The LP constraints could be added like the next formulation:
lp.addRow((double) <= (Lp::Expr) <= (double));
For example:
Lp::Col x1, x2, x3;
lp.addRow(2 <= 2 * x1 + 3 * x2 - 2 * x3 <= 8);
Because the C++ allows overriding every operator, it looks like a good solution
for define range constraints. However, if the -Wparentheses or -Wall is
defined, it emits warnings. For the C language, the warning is a proper
behavior, but the C++ has boolean type, so rather the bool-numeric comparisons
should be warned.


-- 


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



[Bug c++/36921] comparsion does not have mathematical meaning is not correct

2008-07-24 Thread pinskia at gcc dot gnu dot org


--- Comment #1 from pinskia at gcc dot gnu dot org  2008-07-24 20:30 ---
Example?


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

Summary|comparsion does not have|comparsion does not have
   |mathematical meaning is not |mathematical meaning is not
   |correct |correct


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