[PATCH] D146376: Update static_assert message for redundant cases

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 24 08:52:42 PDT 2023


tbaeder added inline comments.


================
Comment at: clang/test/SemaCXX/static-assert.cpp:262
   static_assert(invert(true) == invert(false), ""); // expected-error {{failed}} \
-                                                    // expected-note {{evaluates to 'false == true'}}
 
----------------
Krishna-13-cyber wrote:
> tbaeder wrote:
> > This diagnostic should be kept. From looking at the condition, it is not obvious what the two functions evaluate to.
> The above Binary operator test case says that there are two Boolean expressions,**UsefulToPrintExpr** says we can avoid to print these expressions as they are don't need a note and are understandable.
> 
> So if we go by this we will have to remove the note.By this we are removing note for boolean literals as well as expressions.It will be nice to make it generic rather than specifically target cases of false || false , false && false. As the warning note print out the boolean values which can be avoided giving preference to the other diagnostics in terms of boolean literals and expressions.
I think you are confusing boolean expressions with boolean literals.

What is the problem with fixing this issue by simply ignoring toplevel `BO_LOr` binary operators?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146376/new/

https://reviews.llvm.org/D146376



More information about the cfe-commits mailing list