[PATCH] D108211: Emit sizeof/alignof values as notes when a static_assert fails

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 25 04:55:26 PDT 2022


aaron.ballman added a comment.

In D108211#3748595 <https://reviews.llvm.org/D108211#3748595>, @tbaeder wrote:

> From looking at the output  in  the test cases, the additional diagnostics seem unnecessary to me in almost all cases...?

+1; my observation is that the extra note repeats information because the new note says what the LHS and the RHS of the expression evaluates to. I could see this new note being more useful in a case like: `static_assert(sizeof(foo) + sizeof(bar) == sizeof(baz) / 12);` where there are multiple `sizeof` expressions involved and we could note what each constituent part evaluates to, but I'm not certain it's worth the extra complexity to go to those lengths (I'd want to see real world code where this would really help).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108211



More information about the cfe-commits mailing list