aaron.ballman added a comment.

Should there be an exception to this diagnostic for code involving Boolean 
values? e.g.,

void f(bool a, bool b, bool c) {

  if (a == b == c)
    ;

}

At the very least, it seems like this should also follow GCC's behavior and 
suggest parenthesis directly.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5865
@@ -5864,1 +5864,3 @@
 
+def warn_ternary_comparison : Warning<"ternary comparisons do not work "
+  "as expected">,
----------------
This diagnostic somewhat implies that ?: does not work as expected. I prefer 
GCC's wording for this:

"comparisons like 'X<=Y<=Z' do not have their mathematical meaning"

However, I would love it if we could do one step better and use the same 
operators the user wrote, if reasonable. ;-)


http://reviews.llvm.org/D13643



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to