rsmith added inline comments.

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:3147-3149
+def warn_impcast_literal_to_bool : Warning<
+  "implicit conversion from %0 to %1; will always evaluate to "
+  "'%select{false|true}2'">, InGroup<LiteralConversion>;
----------------
Warning groups are cheap, and fine-grained groups give users a way to 
incrementally roll out our new improved warnings.  Can we retain the 
string-conversion group and add a new warning flag for the new cases (both as 
subgroups of literal-conversion), rather than rolling them into a single group?

I think this diagnostic text is worse for the string literal case than the old 
text: the type of the string literal is not relevant to the warning, and 
displaying it seems confusing. For consistency, something like "implicit 
conversion from string literal to 'bool'; will always evaluate to 'true'" would 
work.

Also, please include the word "literal" in the version of this warning for 
floating-point and character literals. (And actually, maybe using the "implicit 
conversion from floating-point literal to 'bool' [...]" formulation would be 
clearer there too, rather than listing a largely-irrelevant type.)


https://reviews.llvm.org/D15935



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D15935: I... Aaron Ballman via Phabricator via cfe-commits
    • [PATCH] D159... Richard Smith - zygoloid via Phabricator via cfe-commits

Reply via email to