[PATCH] D146376: Update static_assert message for redundant cases

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 30 06:52:16 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/test/SemaCXX/static-assert.cpp:266-268
+  static_assert(invert(true) || invert(true) || false, ""); // expected-error {{failed}}
+  static_assert((true && invert(true)) || false, ""); // expected-error {{failed}}
+  static_assert(true && invert(false) && invert(true), ""); // expected-error {{failed}}
----------------
We really need to see more of the diagnostic to know whether the behavior is reasonable or not.

I was thinking we'd have given a note as to why the failure occurred, but I see now that the current behavior doesn't give a note either. Not that I think this is related to your patch, but the current behavior seems a bit surprising: https://godbolt.org/z/erPGdsanK  Note how the last diagnostic points to exactly where the failure comes from but the first two use the entire expression as the failure.


================
Comment at: llvm/utils/gn/secondary/clang-tools-extra/clangd/unittests/BUILD.gn:26
     "//clang/lib/Serialization",
+    "//clang/lib/Testing",
     "//clang/lib/Tooling",
----------------
This seems like an unrelated change.


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